Menu

#110 problem with length macros in `\deffootnote`

KOMA-Script 3.49.3
closed
2026-09-01
2026-09-01
No

[v3.49.2]

Consider the following example code

\documentclass{scrartcl}

\newlength{\X}
\setlength{\X}{1em}

\deffootnote[1em]{1em}{1em}{%
  \textsuperscript{\thefootnotemark}~%
}

\def\Y{Bla bla bla bla bla bla bla bla}

\textheight 20ex
\textwidth  10em


\begin{document}

\framebox[1em]{X}

\framebox[\X]{X}

This is a test\footnote{\Y}.

\end{document}

As can be seen, it doesn't matter whether I use 1em or \X in the optional argument of the \framebox macro.

Image koma-script-length.png shows how this renders with pdflatex.

If I now replace the line

\deffootnote[1em]{1em}{1em}{%

with

\deffootnote[\X]{1em}{1em}{%

I get a different result, which is completely unexpected – the length is larger; see image koma-script-macro.png.

Maybe there is somewhere a line end in the code not being properly protected with %?

2 Attachments

Discussion

  • Werner LEMBERG

    Werner LEMBERG - 2026-09-01

    BTW, a similar effect happens if I replace 1em with \X in the first mandatory argument of \deffootnote.

     
  • Markus Kohm

    Markus Kohm - 2026-09-01

    When LaTeX runs \@makefntext the font size is already \footnotesize. Length \X is set to 1em in the font size of the active font at \setlength{\X}{1em} time not at usage of \X. So you would need to compare:

    \documentclass{scrartcl}
    
    \newlength{\X}
    \setlength{\X}{1em}
    
    \newcommand*{\Xmacro}{1em}
    
    \deffootnote[1em]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    \def\Y{Bla bla bla bla bla bla bla bla}
    
    \textheight 50ex
    \textwidth  10em
    
    
    \begin{document}
    
    {\footnotesize
    \framebox[1em]{X}
    
    \framebox[\X]{X}\par}
    
    This is a test\footnote{\Y{} using preamble 1em}.
    
    \deffootnote[1em]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    This is a test\footnote{\Y{} using body 1em}.
    
    \deffootnote[\X]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    This is a test\footnote{\Y{} using preamble length \the\X which is not
      \the\dimexpr 1em\relax}.
    
    \deffootnote[\Xmacro]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    This is a test\footnote{\Y{} using preamble macro \the\dimexpr\Xmacro\relax
      which is \the\dimexpr 1em\relax}.
    
    \end{document}
    

    or:

    \documentclass{scrartcl}
    
    \newlength{\X}
    \footnotesize
    \setlength{\X}{1em}
    \normalsize
    
    \newcommand*{\Xmacro}{1em}
    
    \deffootnote[1em]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    \def\Y{Bla bla bla bla bla bla bla bla}
    
    \textheight 60ex
    \textwidth  10em
    
    
    \begin{document}
    
    {\footnotesize
    \framebox[1em]{X}
    
    \framebox[\X]{X}\par}
    
    This is a test\footnote{\Y{} using preamble 1em}.
    
    \deffootnote[1em]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    This is a test\footnote{\Y{} using body 1em}.
    
    \deffootnote[\X]{1em}{1em}{%
      \textsuperscript{\thefootnotemark}~%
    }
    
    This is a test\footnote{\Y{} using preamble length \the\X which is \the\dimexpr 1em\relax}.
    
    \end{document}
    
     

    Last edit: Markus Kohm 2026-09-01
  • Markus Kohm

    Markus Kohm - 2026-09-01
    • labels: --> nothing to do, \deffootnote, \setlength
    • status: open --> closed
    • assigned_to: Markus Kohm
     
  • Markus Kohm

    Markus Kohm - 2026-09-01

    Length are not macros.

    Works as expected.

     
    • Werner LEMBERG

      Werner LEMBERG - 2026-09-01

      Ah, silly me, I forgot that 'em' is a relative size. Thanks for the explanation, and sorry for the noise.

       

Log in to post a comment.