4

My publisher has some rather complicated demands regarding the footnote layout:

  • footnote text always aligned left: for 1-digit footnotes indented 4mm, for 2-digit 5mm, for 3-digit 6mm
  • footnote numbers (markers) aligned left
  • on pages with a switch from 1- to 2-digit and from 2- to 3-digit footnotes all the footnote text should have an indent of the respectively larger group (5mm resp. 6mm), the footnote markers should still be aligned left, BUT the ones with the lesser digits should be aligned to the right-hand edge of the bigger numbers.

Is that possible at all?

The following answers were not working:

Indentation of footnotes depending on number of digits in footnote marks on the same page resulted in a switch of the indent not between 9 and 10 but between 3 and 4, and somehow fancyhdr and titlesec packages interfered with the result. And it also could not help with the alignement of the smaller numbers.

Right-align one and two digit footnote marks with KOMA does align the numbers at the right side, but for all numbers, not only for pages with a digit increase.

Because of the above mentioned interferences with other packages I've intentionally left some packages and preamble definitions in my MWE that on first sight do not have any connection to the problem.

MWE:

\documentclass[10pt]{book}
\usepackage[paperheight=22.2cm,paperwidth=14cm,bottom=2.11cm,top=1.6cm,right=1.6cm,textwidth=10.8cm,textheight=18.49cm,includeheadfoot]{geometry}
\setlength{\parindent}{3.5mm}
\usepackage{ebgaramond}
\usepackage{titlesec}
\usepackage{csquotes}
\usepackage{marvosym}
\usepackage{etoolbox}
\usepackage[hang]{footmisc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyhead[CO]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\rightmark}}
\fancyhead[CE]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\leftmark}}
\renewcommand{\headrulewidth}{0pt}

\usepackage{polyglossia}%
\setmainlanguage[babelshorthands=true]{german}
\setotherlanguage{hebrew}
\defaultfontfeatures{RawFeature={-clig}}
\setmainfont[Mapping=tex-text,Numbers=OldStyle,Ligatures=TeX]{EB Garamond}
\addfontfeature{Language=German}
\newfontfamily\hebrewfont{Linux Libertine O}

\makeatletter
  \newcommand\chapsize{\@setfontsize\chapsize{13pt}{6}}
  \newcommand\secsize{\@setfontsize\secsize{11.5pt}{6}}
  \makeatother
\titleformat{\chapter}[hang]
   {\chapsize\centering}{\thechapter.\ }{0pt}{}
\titleformat{\section}[hang] 
    {\secsize\centering}{\thesection\ }{0pt}{}
\titlespacing*{\chapter}{0pt}{0pt}{8mm}
\titlespacing*{\section}{0pt}{24pt}{4.233mm}

%fußnoten
\renewcommand\footnotelayout{\fontsize{8.8}{10.2}\selectfont}
\usepackage{scrextend}
\deffootnote{5mm}{5mm}{\makebox[5mm][l]{\phantom{99}\llap{\thefootnotemark}}}

\begin{document}
Text.\footnote{text}
Text.\footnote{text}\footnote{text}\footnote{text}
\clearpage
\footnote{text}\footnote{text}\footnote{text}
\footnote{text}\footnote{text}\footnote{text}\footnote{text}
\clearpage
\footnote{text}\footnote{text}
\setcounter{footnote}{98}
\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}

\end{document}

The way it should look like:

enter image description here

The way it looks like with the MWE:

enter image description here

Compiling with XeLaTeX, general book class (KOMA not an option because of collision with fancyhdr and others).

2
  • Does the answer to this question help? tex.stackexchange.com/questions/461271/… (it covers only one and two digit footnotes, but can be extended). Commented Feb 2, 2019 at 6:30
  • Thank you for your comment. I mentioned this question above. If I use the OP's proposal, I get the same result: indents according to digits of footnotes, but two different footnote text indents on pages with footnote 9 and 10. If I use the answer proposed all footnote text is indented with the higher value, not only footnotes above 10. Maybe my setup is too complicated, because I use /footnote as well as /footcite commands?
    – shevek
    Commented Feb 2, 2019 at 22:06

3 Answers 3

3

The rather complicated demands of your publisher I have never heard. Do you know where they come from? Which publisher is that?

The demands make it easier to change the definition of footmisc than to change the KOMA-Script mechanism for footnotes, and at last you use class book and not scrbook.

There are three problems with the code from your linked question with footmisc:

  1. You need to expand the new solution to handle footnotenumbers greater 99 (see first <================== in following code snippet).
  2. You have to change the values to get the footnotenumber indented as wanted (see the three short <===== markings in the following code snippet).
  3. You have to change that solution to print right justified footnote numbers by at last adding command \hfil (see last <================== in following code snippet).

This code snippet shows the needed changings for your issue:

   \ifnumgreater{\value{footnote}}{99} % <==============================
     {\immediate\write\@auxout{%
        \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 6mm}} % <======
     {\ifnumgreater{\value{footnote}}{9}
       {\immediate\write\@auxout{%
          \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 5mm}} % <====
       {\immediate\write\@auxout{%
         \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 4mm}}}% <=====
   % remove superscript footnote mark
   \setbox\@tempboxa\hbox{%
     \ifdim\footnotemargin>0pt
       \hb@xt@\footnotemargin{\hfil\@thefnmark\hss}% <==================
     \else
       \hbox{\@thefnmark}%
     \fi

Please see that I deleted some of your code because it is not relevant for your issue or I do not have the fonts you used.

With this complete MWE

\documentclass[10pt]{book}

\usepackage[%
  paperheight=22.2cm,paperwidth=14cm,
  bottom=2.11cm,top=1.6cm,right=1.6cm,
  textwidth=10.8cm,textheight=18.49cm,
  includeheadfoot,
  showframe
]{geometry}
\setlength{\parindent}{3.5mm}
\usepackage{ebgaramond}
\usepackage{titlesec}
\usepackage{csquotes}
\usepackage{marvosym}
\usepackage{etoolbox}

\usepackage[hang]{footmisc}
\renewcommand{\hangfootparskip}{0mm}
\renewcommand{\hangfootparindent}{4mm}
\makeatletter
\patchcmd{\@makefntext}
  {\bgroup
   \setbox\@tempboxa\hbox{%
     \ifdim\footnotemargin>0pt
       \hb@xt@\footnotemargin{\@makefnmark\hss}%
     \else
       \@makefnmark
     \fi
   }}
  {\bgroup
   \ifcslength{@\thepage @max@footnotemargin}
     {\footnotemargin \csname @\thepage @max@footnotemargin\endcsname}
     {}%
   \immediate\write\@auxout{%
     \noexpand\expandafter\noexpand\newskip
       \noexpand\csname @\thepage @max@footnotemargin\endcsname}%
   \ifnumgreater{\value{footnote}}{99} % <==============================
     {\immediate\write\@auxout{%
        \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 6mm}} % <======
     {\ifnumgreater{\value{footnote}}{9}
       {\immediate\write\@auxout{%
          \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 5mm}} % <====
       {\immediate\write\@auxout{%
         \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 4mm}}}% <=====
   % remove superscript footnote mark
   \setbox\@tempboxa\hbox{%
     \ifdim\footnotemargin>0pt
       \hb@xt@\footnotemargin{\hfil\@thefnmark\hss}% <==================
     \else
       \hbox{\@thefnmark}%
     \fi
   }}
  {}
  {}
\makeatother

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyhead[CO]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\rightmark}}
\fancyhead[CE]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\leftmark}}
\renewcommand{\headrulewidth}{0pt}

\makeatletter
  \newcommand\chapsize{\@setfontsize\chapsize{13pt}{6}}
  \newcommand\secsize{\@setfontsize\secsize{11.5pt}{6}}
  \makeatother
\titleformat{\chapter}[hang]
   {\chapsize\centering}{\thechapter.\ }{0pt}{}
\titleformat{\section}[hang] 
    {\secsize\centering}{\thesection\ }{0pt}{}
\titlespacing*{\chapter}{0pt}{0pt}{8mm}
\titlespacing*{\section}{0pt}{24pt}{4.233mm}

\begin{document}
Text.\footnote{text}
Text.\footnote{text}\footnote{text}\footnote{text}
\clearpage
\footnote{text}\footnote{text}\footnote{text}
\footnote{text}\footnote{text}\footnote{text}\footnote{text}
\clearpage
\footnote{text}\footnote{text}
\setcounter{footnote}{98}
\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}\footnote{text}

\end{document}

you get for example the resulting page 3:

page 3

2
  • thank you very much. The hfil did align the numbers almost to the right of the numbers > 9 resp >99. But than again, they also drift away from the left margin where they are supposed to stay. The publisher is Wallstein, and they don't use TeX, that's why I have to do the layout on my own (I wrote the book in LaTeX, not in Word like obviously most of their authors...). And yes, those demands are hellishly complicated. I wonder how they achieve this with whatever they use as a layout software. I'll probably give up and make all notes indented by 5mm, all marks left-aligned.
    – shevek
    Commented Feb 4, 2019 at 21:19
  • Just because indenting footnotes 9 and 10 equally in LaTeX is difficult doesn't make the publisher's demand a complex or unreasonable one. Commented Dec 4, 2023 at 20:08
1

This modification of your MWE and the answer from Indentation of footnotes depending on number of digits in footnote marks on the same page do the job for me. (I had to switch to English though as I don't have German or Hebrew languages support installed on my system.) To get the hangindents right you'd have to run LaTeX twice, as they are stored in the AUX file during the first run.

\documentclass[10pt]{book}
\usepackage[paperheight=22.2cm,paperwidth=14cm,bottom=2.11cm,top=1.6cm,right=1.6cm,textwidth=10.8cm,textheight=18.49cm,includeheadfoot]{geometry}
\setlength{\parindent}{3.5mm}
\usepackage{lipsum}
\usepackage{ebgaramond}
\usepackage{csquotes}
\usepackage{marvosym}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyhead[CO]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\rightmark}}
\fancyhead[CE]{\fontsize{9.5}{10.5}\selectfont\scshape\MakeLowercase{\leftmark}}
\renewcommand{\headrulewidth}{0pt}

\usepackage{polyglossia}%
\setmainlanguage{english}
%\setmainlanguage[babelshorthands=true]{german}
%\setotherlanguage{hebrew}
\defaultfontfeatures{RawFeature={-clig}}
\setmainfont[Mapping=tex-text,Numbers=OldStyle,Ligatures=TeX]{EB Garamond}
\addfontfeature{Language=German}
\newfontfamily\hebrewfont{Linux Libertine O}

\usepackage{titlesec}
\makeatletter
  \newcommand\chapsize{\@setfontsize\chapsize{13pt}{6}}
  \newcommand\secsize{\@setfontsize\secsize{11.5pt}{6}}
\makeatother
\titleformat{\chapter}[hang]
   {\chapsize\centering}{\thechapter.\ }{0pt}{}
\titleformat{\section}[hang] 
    {\secsize\centering}{\thesection\ }{0pt}{}
\titlespacing*{\chapter}{0pt}{0pt}{8mm}
\titlespacing*{\section}{0pt}{24pt}{4.233mm}

\usepackage[hang]{footmisc}
\renewcommand{\hangfootparskip}{0mm}
\renewcommand{\hangfootparindent}{4mm}
\makeatletter
\patchcmd{\@makefntext}
  {\bgroup
   \setbox\@tempboxa\hbox{%
     \ifdim\footnotemargin>0pt
       \hb@xt@\footnotemargin{\@makefnmark\hss}%
     \else
       \@makefnmark
     \fi
   }}
  {\bgroup
   \ifcslength{@\thepage @max@footnotemargin}
     {\footnotemargin \csname @\thepage @max@footnotemargin\endcsname}
     {}%
   \immediate\write\@auxout{%
     \noexpand\expandafter\noexpand\newskip
       \noexpand\csname @\thepage @max@footnotemargin\endcsname}%
   \ifnumgreater{\value{footnote}}{99}
     {\immediate\write\@auxout{%
        \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 6mm}}
     {\ifnumgreater{\value{footnote}}{9}
       {\immediate\write\@auxout{%
          \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 5mm}}
       {\immediate\write\@auxout{%
         \global\noexpand\csname @\thepage @max@footnotemargin\endcsname 4mm}}}%
   % remove superscript footnote mark
   \setbox\@tempboxa\hbox{%
     \ifdim\footnotemargin>0pt
       \hb@xt@\footnotemargin{\hbox{\normalfont \@thefnmark}\hss}%
     \else
       \hbox{\normalfont \@thefnmark}%
     \fi
   }}
  {}
  {}
\makeatother
\begin{document}
\null\vfill
Filler text.\footnote{\lipsum*[2]}
Filler text.\footnote{\lipsum*[2]\par\lipsum*[2]}
\clearpage
\null\vfill
\setcounter{footnote}{8}
Filler text.\footnote{\lipsum*[2]}
Filler text.\footnote{\lipsum*[2]\par\lipsum*[2]}
\clearpage
\null\vfill
\setcounter{footnote}{98}
Filler text.\footnote{\lipsum*[2]}
Filler text.\footnote{\lipsum*[2]\par\lipsum*[2]}
\end{document}

The result:

enter image description here

enter image description here

enter image description here

3
  • Thank you, this works indeed if I use exactly my preamble and the filler text. But strange enough it does not if I apply my document text body. There must be something in it that confuses the counting. It applies the rule for footnote numbers above 100 all the time. After an hour of testing and futile vivisection I have to give up for today. I hope I come up with an idea tomorrow.
    – shevek
    Commented Feb 3, 2019 at 21:15
  • If I use real long text instead of \clearpage the indentation from the larger footnote numbers kind of "spills over" to the smaller ones, e.g. if you try a document body like: Text.\footnote{text} Footnotes 1 to 6.\footnote{text}text\footnote{text}text.\footnote{text}5.\footnote{text}6.\footnote{text} \lipsum[4-10] And now numbers 7 to 10.\footnote{text} 8.\footnote{text}9.\footnote{text} 10.\footnote{text} And now:\footnote{text} \setcounter{footnote}{98} the 99!\footnote{text}Hm.\footnote{text} Hmmmm.\footnote{text}\footnote{text}\footnote{text}\footnote{text}
    – shevek
    Commented Feb 5, 2019 at 10:17
  • In the example above footnotes 1 to 6 are displayed as intended, but 7 to 10 assume the indentation of those greater than 99. If you replace the lipsum count 4-10 with 4-6 you get even weirder phenomena: footnote 1 to 6 use the indent for numbers greater 9, footnotes 7 to 10 the correct one, and above 10, although at the same page, switch to the indent for numbers greater than 99. Do you have an idea what could cause this? Something in the paragraph definition?
    – shevek
    Commented Feb 5, 2019 at 10:33
0

Manually adjusting the width of a vrule until it's correct to a tenth of a point did the job for me. I placed ones of identical width in front of "This" and "apply" to get the result below. Fortunately the "9" being left-justified is OK for my situation.

footnote indentation

1
  • (I also set the height and depth of the vrule to zero.) Commented Dec 4, 2023 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .