12

Here is my code to generate a text with a footnote:

\documentclass[titlepage,paper=a4,11pt,onecolumn]{scrartcl} 
\usepackage[top=3cm, bottom=3.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage{blindtext}

\footnoterule
\renewcommand{\footnoterule}{%
  \kern -4.5pt
  \hrule width \textwidth height 0.5pt
  \kern 4pt
}                   

\begin{document}

\section{Introduction}
This a piece of text with a footnote here\footnote{This is my footnote} for testing purposes.
\blindtext[2]

\end{document}

I need to change the footnote rule that separates my footnote from the main text to a dotted line, keeping the same the other settings.

12

You're looking for \leaders. \leaders is a TeX primitive used to repeat a box until it fills some space. I used \xleaders here: the x stands for "expanded leaders", to ensure the dots are placed aligned with the margins.

I added three customisation points: \fnoterulesep is the distance between two consecutive dots, and \fnoterulechar is the character to be repeated. Here's an example with 2pt and .:

enter image description here

and here with 5pt and $\bullet$:

enter image description here

I also added a \fnoteruleaftersep to tweak the distance between the rule and the footnotes.

\documentclass[titlepage,paper=a4,11pt,onecolumn]{scrartcl} 
\usepackage[top=3cm, bottom=3.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage{blindtext}

\newlength\fnoterulesep
\setlength\fnoterulesep{2pt}
\newlength\fnoteruleaftersep
\setlength\fnoteruleaftersep{4pt}
\newcommand\fnoterulechar{.}
\renewcommand{\footnoterule}{%
  {\sbox0{\fnoterulechar\kern\fnoterulesep}%
   \par\vspace*{\dimexpr-\baselineskip+\ht0+\dp0-\fnoteruleaftersep}%
  \noindent
  \xleaders\hbox{%
    \fnoterulechar
    \kern\fnoterulesep}%
      \hfill\fnoterulechar
  \par \nointerlineskip
  \vspace*{\dimexpr-\ht0-\dp0+\fnoteruleaftersep}}%
}

\begin{document}

\section{Introduction}
This a piece of text with a footnote here\footnote{This is my footnote} for testing purposes.

\blindtext[2]

\end{document}
5
  • I think you need to adjust the vertical space the total is supposed to be 0pt, but you have a paragraph with the dots – David Carlisle Sep 28 '19 at 12:50
  • This is exactly what I need. Thanks very much!! – José Sep 28 '19 at 13:14
  • @DavidCarlisle Indeed. I fixed it (I think :-). What problem would a non-zero height rule cause? – Phelype Oleinik Sep 28 '19 at 15:46
  • @José See the edit. I fixed the definition after David's comment. – Phelype Oleinik Sep 28 '19 at 15:46
  • 1
    @PhelypeOleinik potentially an overfull page box as the output routine leaves no space for the rule, it is assumed to take zero space – David Carlisle Sep 28 '19 at 16:56
5

Is this what you want?

\documentclass[titlepage,paper=a4,11pt,onecolumn]{scrartcl}
\usepackage[top=3cm, bottom=3.5cm, hmargin=2.5cm]{geometry}
\usepackage[english]{babel}
\usepackage{blindtext}

\makeatletter
\renewcommand{\footnoterule}{%
  \kern -4.5pt
 \vbox to 0.5pt{\hbox to \textwidth{\leaders\hbox{\kern 4pt .\kern 4pt}\hfil}\vss}
  \kern 4pt
}
\makeatother
\begin{document}

\vspace*{12cm}

\section{Introduction}
This a piece of text with a footnote here\footnote{This is my footnote} for testing purposes.
\blindtext[2]

\end{document} 

enter image description here

8
  • you should force the box height to .5pt (or adjust the vskips to total - the height of a the leaders dot). – David Carlisle Sep 28 '19 at 12:51
  • @David Carlisle: do you mean the outer box or the inner box? – Bernard Sep 28 '19 at 12:55
  • well anything, but the output routine leaves no space for a footnote rule so the rule has to be a construct that adds no vertical space, that's why the original had two vskips totalling -.5pt and a rule of height .5pt – David Carlisle Sep 28 '19 at 12:58
  • Your solution also works fine. I will take it as a second option. Thanks very much for you time!! – José Sep 28 '19 at 13:21
  • @DavidCarlisle: I'm not too sure whether my modification makes the code really talke into account the vertical space 5I'm in no way a TeX specialist…) – Bernard Sep 28 '19 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.