5

I'm using Book (KOMA-Script), By default, the footnote runs roughly from left margin to the right margin of the page, I used the following to control the left margin:

\deffootnote[8em]{8em}{8em} {\textsuperscript{\thefootnotemark}}

Result is as following:

right margin

I wondered if there is a way to control the right margin of the footnote? or in another word, the length of the footnote itself? i.e. 2em spacing to the right margin of the page?

2
  • What document class are you using?
    – egreg
    Oct 2, 2012 at 16:35
  • I'm using Book (KOMA-Script).
    – Shi Yuan
    Oct 2, 2012 at 16:36

1 Answer 1

4

Do you really mean 2em from the right margin of the page?

\documentclass{scrbook}
\usepackage{lipsum}

\deffootnote[8em]{8em}{8em} {\textsuperscript{\thefootnotemark}}

\makeatletter
\@ifdefinable{\org@makefntext}{%
  \let\org@makefntext\@makefntext
  \renewcommand*{\@makefntext}{%
    \ifthispageodd{%
      \setlength{\hsize}{\dimexpr\paperwidth-\oddsidemargin-1in-2em}%
    }{%
      \setlength{\hsize}{\dimexpr\paperwidth-\evensidemargin-1in-2em}%
    }%
    \org@makefntext
  }%
}
\makeatother

\begin{document}
\lipsum[1] Hello\footnote{\lipsum[2]}
world.\footnote{\lipsum[3]} \lipsum[4]
\end{document}

2em to the right margin of the page

If you have meant 2em to the right margin of the text body, then the redefinition of \@makefntext simplifies to:

\documentclass{scrbook}
\usepackage{lipsum}

\deffootnote[8em]{8em}{8em} {\textsuperscript{\thefootnotemark}}

\makeatletter
\@ifdefinable{\org@makefntext}{%
  \let\org@makefntext\@makefntext
  \renewcommand*{\@makefntext}{%
    \addtolength{\hsize}{-2em}%
    \org@makefntext
  }%
}
\makeatother

\begin{document}
\lipsum[1] Hello\footnote{\lipsum[2]}
world.\footnote{\lipsum[3]} \lipsum[4]
\end{document}

2em to right margin of text body

4
  • How can this be achieved while using the article class?
    – azetina
    Oct 2, 2012 at 22:51
  • \deffootnote and \isthispageodd are features of KOMA-Script, but the trick with the redefinition of \@makefntext and setting \hsize remains the same for class article. Oct 2, 2012 at 23:03
  • Its ok. I figured it out. I will delete my comments. If you can as well.
    – azetina
    Oct 2, 2012 at 23:25
  • amazing, works like a charm. thanks so much!
    – Shi Yuan
    Oct 3, 2012 at 11:08

You must log in to answer this question.

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