Skip to content

Instantly share code, notes, and snippets.

@h20y6m
Last active May 31, 2022 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h20y6m/221129022513a40a1c4d55652533f461 to your computer and use it in GitHub Desktop.
Save h20y6m/221129022513a40a1c4d55652533f461 to your computer and use it in GitHub Desktop.
(u)pLaTeX で latex-lab するためのなにか
\ExplSyntaxOn
% (u)pLaTeXでなければ何もしない
\bool_lazy_or:nnF
{ \sys_if_engine_ptex_p: }
{ \sys_if_engine_uptex_p: }
{
\ExplSyntaxOff
\file_input_stop:
}
% tagpdfのinterwordspaceオプションが(u)pLaTeXでエラーになるのを回避する
% tagpdf v0.95 で修正済み
% \AddToHook{file/tagpdf.sty/after}{%
% \keys_define:nn { __tag / setup }
% {
% interwordspace .choices:nn = { true, on, false, off }
% { \msg_warning:nnn {tag}{sys-no-interwordspace}{(u)pTeX} },
% interwordspace .default:n = true,
% show-spaces .bool_set:N = \l__tag_showspaces_bool
% }
% }
\AddToHook{file/latex-lab-testphase-new-or.sty/after}{%
\AddToHook{cmd/@makecol/before}{\let\pltx@textbottom\@textbottom}
\AddToHook{cmd/@makecol/after}{\let\@textbottom\pltx@textbottom}
\def\@makecol@cfgpoint {%
% フロート→脚注の順序で挿入
\@outputbox@attachfloats% フロートを挿入
% 脚注の上に \@textbottom を挿入
\ifx\@textbottom\relax \else
\@outputbox@append{\@textbottom}%
\let\@textbottom=\relax
\fi
\@outputbox@reinsertbskip% よくわからない
\@outputbox@appendfootnotes% 脚注を挿入
% 縦組み時にフッタがずれないようにする
\@outputbox@append{%
\pltx@adjust@wd@outputbox
\vskip-\@outputbox@depth}% 謎の補正
}
}
\AddToHook{file/latex-lab-footnotes.ltx/after}{%
% pLaTeXが再定義したものをlatex-lab-footnotesが再々定義するので再々々定義
\renewcommand\@makefnmark{%
\ifydir \hbox{}\hbox{\@textsuperscript{\normalfont\@thefnmark}}\hbox{}%
\else\hbox{\yoko\@textsuperscript{\normalfont\@thefnmark}}\fi}
% \fnote_footnotemark:にパッチを当てる
\tl_replace_once:Nnn \fnote_footnotemark:
{ \@makefnmark } { \pltx@makefnmark@cfgpoint }
\cs_set_eq:NN \@footnotemark \fnote_footnotemark:
% 脚注記号の出力位置の調整(pLaTeXの\@footnotemark)
\def\pltx@makefnmark@cfgpoint{%
\ifydir\@makefnmark
\else\hbox to\z@{\hskip-.25zw\raise.9zh\@makefnmark\hss}\fi
}
}
\ExplSyntaxOff
@h20y6m
Copy link
Author

h20y6m commented May 3, 2022

Version

  • LaTeX2e <2022-06-01> pre-release-3
  • latex-lab-dev 2022-06-01 pre-release 2

Example

%#! platex-dev
\RequirePackage{platex-lab}
\DocumentMetadata{backend=dvipdfmx,testphase=phase-II}
\documentclass[dvipdfmx,a4paper]{tarticle}

\usepackage{hyperref}
\usepackage{bxjalipsum}

\begin{document}

ここ\footnote{これが脚注です。}に脚注を付けます。
\begin{figure}[b]
  \centering
  \frame{\Huge 猫}
  \caption{猫である。}
\end{figure}

\jalipsum[5]{wagahai}

\section{吾輩は猫である6}

\jalipsum[6]{wagahai}

\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment