
私は原稿コードを使用して、特別な方法で脚注マークを設定しています。すべての脚注マークは左揃えで設定されます。脚注マークの数字が異なるページを除きます。そのようなページでは、最大の脚注の一番右の数字が、他のすべての脚注の位置を示します。
コードは@cabohahからのもので、投稿されていますここ
すべてうまく機能しています。コンパイルを 2 回実行した後、すべてが正常になりました。1 桁、2 桁、または 3 桁の脚注の位置はすべて、必要なとおりです。
しかし、コードが失敗し、ファイルに破損した脚注とページの関係を書き込む例が 1 つ見つかりましたaux
。\setcounter{footnote}{4}
脚注マーク 5 ~ 9 の位置が間違っていますが、脚注カウンターを 3 または 5 で開始すると、正しい位置になります。
これをデバッグするためのヘルプはありますか?
\documentclass[pagesize,parskip=half,DIV=11]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}% shouldn't be needed any longer
\usepackage[german]{babel}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{lipsum}
\parindent 7mm% Really, paragraph skip _and_ indent???
\newlength{\myfnindent}
\newlength{\myfnnumwidth}
\deffootnote{\myfnindent}{\myfnindent}{% indent of footnote text and paragraphs
\makebox[\myfnindent][l]{% inside this indent left align a
\makebox[\myfnnumwidth][r]{% box of per page number width with right aligned
\thefootnotemark% bold footnote mark
% HJELE \bfseries\thefootnotemark% bold footnote mark
}%
}%
}
\makeatletter
\AddtoDoHook{footnote/text/begin}{%
\settowidth{\myfnnumwidth}{\footnotesize\thefootnotemark}% width of current footnote mark
% HJELE \settowidth{\myfnnumwidth}{\footnotesize\bfseries\thefootnotemark}% width of current footnote mark
\immediate\write\@auxout{\noexpand\global\noexpand\@namedef{fnnumwidth@\thepage}{\the\myfnnumwidth}}% write it as current widest per page mark width to aux-file
\@ifundefined{fnnumwidth@\thepage}{}{% if the aux file has had per page values for this page
\setlength{\myfnnumwidth}{\@nameuse{fnnumwidth@\thepage}}% use (the last one) as current width of the number bix
}%
\@gobble% Because the do-hook code expects always has an argument.
}
\makeatletter
\AtBeginDocument{% becaue font initialization usually happens at \begin{document}
% HJELE \settowidth{\myfnindent}{\footnotesize\bfseries 888\enskip}% In this example
\settowidth{\myfnindent}{\footnotesize 888\enskip}% In this example
% 888 is the widest used number and this is
% used to setup the footnote text indent.
}
\begin{document}
\lipsum[1]
% HJELE: set this value to 3 or 5, everything is fine
% HJELE: set this value to 4, the positioning of the
% footnotemarks is just on this page incorrect
% --> see the aux file for the wrong page--footnote--relation
\setcounter{footnote}{5}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
A one digit bigger footnotemark.\footnote{huhu}
\lipsum[1-2]
\end{document}
答え1
これは、この無意味な要件で脚注を移動する際に発生する問題です。たとえば、脚注ごとに 1 つのラベルがあるため、LaTeX をもう 1 回実行するだけで、次の問題を解決できます。
\documentclass[pagesize,% Option is already the default. So you can remove it.
parskip=half,DIV=11]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}% shouldn't be needed any longer
\usepackage[german]{babel}% Do you really use the old German spelling from the
% last century???
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{lipsum}
\usepackage{refcount}
\parindent 7mm% BAD CODE! See the KOMA-Script manual how to change paragraph
% indent and paragraph skip. But using both is not recommended!
\newlength{\myfnindent}
\newlength{\myfnnumwidth}
\deffootnote{\myfnindent}{\myfnindent}{% indent of footnote text and paragraphs
\makebox[\myfnindent][l]{% inside this indent left align a
\makebox[\myfnnumwidth][r]{% box of per page number width with right aligned
\thefootnotemark% bold footnote mark
% HJELE \bfseries\thefootnotemark% bold footnote mark
}%
}%
}
\makeatletter
\AddtoDoHook{footnote/text/begin}{%
\settowidth{\myfnnumwidth}{\footnotesize\thefootnotemark}% width of current footnote mark
% HJELE \settowidth{\myfnnumwidth}{\footnotesize\bfseries\thefootnotemark}%
% width of current footnote mark
\label{ftn:\thefootnotemark}%
\immediate\write\@auxout{\noexpand\global\noexpand\@namedef{fnnumwidth@\getpagerefnumber{ftn:\thefootnotemark}}{\the\myfnnumwidth}}% write it as current widest per page mark width to aux-file
\@ifundefined{fnnumwidth@\getpagerefnumber{ftn:\thefootnotemark}}{}{% if the aux file has had per page values for this page
\setlength{\myfnnumwidth}{\@nameuse{fnnumwidth@\getpagerefnumber{ftn:\thefootnotemark}}}% use (the last one) as current width of the number bix
}%
\@gobble% Because the do-hook code expects always has an argument.
}
\makeatletter
\AtBeginDocument{% becaue font initialization usually happens at \begin{document}
% HJELE \settowidth{\myfnindent}{\footnotesize\bfseries 888\enskip}% In this example
\settowidth{\myfnindent}{\footnotesize 888\enskip}% In this example
% 888 is the widest used number and this is
% used to setup the footnote text indent.
}
\begin{document}
\lipsum[1]
% HJELE: set this value to 3 or 5, everything is fine
% HJELE: set this value to 4, the positioning of the
% footnotemarks is just on this page incorrect
% --> see the aux file for the wrong page--footnote--relation
\setcounter{footnote}{4}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
Very small footnotemark.\footnote{\blindtext}
A one digit bigger footnotemark.\footnote{huhu}
\lipsum[1-2]
\end{document}
注: このような奇妙な脚注の書式設定はお勧めしません。そのため、これ以上時間を費やすつもりはありません。