
MWE는 다음과 같습니다.
\documentclass[12pt]{scrartcl}
%%Footnote Mods%%
\deffootnote[1.8em]{0pt}{1.6em}{\textsuperscript{\thefootnotemark}}
%%%%%%
\begin{document}
Sample text%
%
\footnote{Footnote text}
%
\end{document}
각주 표시의 상단을 각주 텍스트의 상단과 어떻게 정렬합니까(MWE에서는 "1"의 상단을 "F"와 같은 높이로 만들고 싶습니다)?
새로운 오류: Werner의 (훌륭한) 솔루션을 구현할 때 "\"가 포함된 항목을 각주 텍스트에 추가하려고 할 때 오류가 발생했습니다.
관찰하다:
\documentclass[12pt]{scrartcl}% http://ctan.org/pkg/koma-script
\usepackage{xstring}% http://ctan.org/pkg/xstring
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% Patch \scr@saved@footnotetext to extract first character of footnote and store in \fnfirstchar
\patchcmd{\scr@saved@footnotetext}% <cmd>
{\@makefntext}% <search>
{\StrLeft{#1}{1}[\fnfirstchar]\@makefntext}% <replace>
{}{}% <success><failure>
\begin{document}
\makeatletter
\deffootnote[1.8em]{0pt}{1.6em}{%
\settoheight{\@tempdima}{\fnfirstchar}% Height of first character in footnote
\settoheight{\@tempdimb}{$\scriptstyle\thefootnotemark$}% Height of footnote mark
\raisebox{\dimexpr\@tempdima-\@tempdimb}{$\scriptstyle\thefootnotemark$}}
\makeatother
Sample text\footnote{Footnote text: \S modified}.
\end{document}
답변1
이에 대한 짧은 대답은 "정확한 배치"가 항상 가능한 것은 아니라는 것입니다. 왜? TeX는 문자가 아닌 상자와 함께 작동한다는 점에 유의하는 것이 중요합니다. 각 캐릭터에는 수평 및 수직 크기/구조를 정의하는 경계 상자가 있습니다. 따라서 요소 정렬은 이러한 상자의 정밀도까지만 수행될 수 있습니다. 그런 의미에서 당신이 할 수 있는 최선은 아마도 다음과 같습니다:
\makeatletter
\deffootnote[1.8em]{0pt}{1.6em}{%
\settoheight{\@tempdima}{F}% Height of F
\settoheight{\@tempdimb}{$\scriptstyle\thefootnotemark$}% Height of footnote mark
\raisebox{\dimexpr\@tempdima-\@tempdimb}{$\scriptstyle\thefootnotemark$}}
\makeatother
이는 각각 및 에 높이 F
와 \scriptstyle
각주 표시를 저장합니다 (스크래치 레지스터임). 그런 다음 각주( 에서 제공 )를 올바른 높이로 올립니다 . "박싱 제한"으로 인해 출력이 예상과 다릅니다. 다음은 예로서 다양한 출력을 보여주는 최소한의 예입니다. 또한 각주의 첫 번째 문자를 캡처하도록 업데이트되었습니다(문자에 고정하는 대신 ).\@tempdima
\@tempdimb
\thefootnotemark
F
\documentclass[12pt]{scrartcl}% http://ctan.org/pkg/koma-script
\usepackage{xstring}% http://ctan.org/pkg/xstring
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% Patch \scr@saved@footnotetext to extract first character of footnote and store in \fnfirstchar
\patchcmd{\scr@saved@footnotetext}% <cmd>
{\@makefntext}% <search>
{\StrLeft{#1}{1}[\fnfirstchar]\@makefntext}% <replace>
{}{}% <success><failure>
\begin{document}
% Original footnote modification
\deffootnote[1.8em]{0pt}{1.6em}{\textsuperscript{\thefootnotemark}}
Sample text\footnote{Footnote text: original}.
\addtocounter{footnote}{-1}% Restore counter value
\makeatletter
\deffootnote[1.8em]{0pt}{1.6em}{%
\settoheight{\@tempdima}{\fnfirstchar}% Height of first character in footnote
\settoheight{\@tempdimb}{$\scriptstyle\thefootnotemark$}% Height of footnote mark
\raisebox{\dimexpr\@tempdima-\@tempdimb}{$\scriptstyle\thefootnotemark$}}
\makeatother
Sample text\footnote{Footnote text: modified}.
\end{document}
xstring
를 통해 각주의 첫 번째 문자를 캡처하여 \StrLeft
에 저장합니다 \fnfirstchar
.etoolbox
올바른 위치에 추출을 삽입하여 적절한 명령을 패치합니다(~ 후에각주 텍스트를 읽었지만~ 전에조판 중입니다).
예를 들어, 각주 표시와 F
문자를 박스로 묶으면 동일한 높이에 배치되었음을 알 수 있습니다(TeX에서 보는 것처럼).
답변2
덜 기술적이지만 더 인쇄상의 방법은 패키지를 사용하는 것입니다.superiors
. 매뉴얼에서 인용 :
LaTeX에서 각주와 미주 표시의 기본 동작은 숫자를 수학 위 첨자처럼 인쇄하는 것입니다. 대부분의 경우 크기가 일반 안감 도형의 70% 정도이고 윗부분이 대문자 윗부분보다 약간 위에 있다는 의미입니다. 많은 경우, 위 첨자 그림은 모든 차원에서 약 70%만큼 줄어들어 지나치게 크긴 하지만 약간 가늘게 보입니다. [...]
대안으로, 1234567890과 같이 우수한 숫자(보통 안감 숫자 높이의 50%~60%)인 작은 숫자를 사용할 수 있습니다. 일반적으로 숫자의 상단이 대문자의 상단과 정렬되도록 디자인됩니다. 글꼴에서는 때로는 약간 더 높지만 오름차순 높이에 해당합니다.
\documentclass[12pt]{scrartcl}
%%Footnote Mods%%
\deffootnote[1.8em]{0pt}{1.6em}{\textsu{\thefootnotemark}\,}
%%%%%%
\usepackage{newtxtext}
\usepackage[supstfm=ntxsups,supspaced=.06em]{superiors}
\begin{document}
Sample text%
%
\footnote{Footnote text}
%
\end{document}
추가적으로 패키지 옵션을 사용하면 raised=<dim>
위 첨자 숫자의 수직 위치를 조정할 수 있습니다. 물론 수직 위치는 다음 문자에 따라 달라지지 않습니다. (하지만 어쨌든 다음 토큰이 작 a
거나 제어 시퀀스라면 어떻게 될까요?)
답변3
Werner의 솔루션에서는 어떤 패키지도 로드할 필요가 없다고 생각했습니다. 둘 다etoolbox그리고xstring상대적으로 큰 패키지입니다.
\documentclass[12pt]{scrartcl}
\makeatletter
\begingroup
\let\@tempa\scr@saved@footnotetext
\edef\@tempa{\endgroup
\def\noexpand\scr@saved@footnotetext##1{%
\unexpanded\expandafter{\@tempa{#1}}%
\unexpanded{\fngetfirstchar\fnfirstchar{#1}}%
}%
}
\@tempa
\def\fngetfirstchar#1#2{%
\begingroup
\def\@tempa##1##2\fn@nil{\endgroup\gdef#1{##1}}%
\expandafter\@tempa#2\fn@nil
}
\def\usenewfootnotestyle{%
\deffootnote[1.8em]{0pt}{1.6em}{%
\begingroup
\let\s\ensuremath
\settoheight{\@tempdima}{\fnfirstchar}%
\settoheight{\@tempdimb}{\s{\scriptstyle\thefootnotemark}}%
\raisebox{\dimexpr\@tempdima-\@tempdimb}{\s{\scriptstyle\thefootnotemark}}%
\endgroup
}%
}
\makeatother
\begin{document}
% Original footnote style:
\deffootnote[1.8em]{0pt}{1.6em}{\textsuperscript{\thefootnotemark}}
Sample text\footnote{Footnote text: original}.
\par
\addtocounter{footnote}{-1}
% Change footnote style:
\usenewfootnotestyle
Sample text\footnote{Footnote text: modified}.
\end{document}