3

I wish to write a line of (small size) text at the very lower border of the page (below the footer). Is it even possible? How?

I need it for a \documentclass[titlepage,a4paper,12pt]{article}, ~700 pages document.

I tried \renewcommand{\turnthepage}{\footnotesize{My version of \today{,} \currenttime{.}}}, but it does not seem to go below the footer space.

Thanks.

2
  • 1
    Yes it is possible. \AddToHook{shipout/background}{...} will run on every page. The only question is whether to use tikzpagenodes or calculate the x,y coordinates yourself. Commented Dec 8, 2020 at 16:09
  • How do I accept two answers? :-)
    – mario
    Commented Dec 8, 2020 at 22:41

2 Answers 2

6

One advantage of the xcoffin package is that allows to put stuff anywhere in the page, even outside the margins, footer, heads, etc.

You put the content in a box (\Timex) and join to an empty box (\Frame), with appropriate offsets. The \Typeset will put the assembly in the current insertion point so it has to be shifted to the left and down. There are two values I added (1ex and 7ex) that might need to be adjusted if the font is changed. The same if you decided to use the geometry package.

The package atbegshi will then put the sentence in every page, in the lower left corner.

\documentclass[titlepage,a4paper,12pt]{article}

\usepackage[us,12hr]{datetime} 

\usepackage{xcoffins}
\usepackage{kantlipsum} % dummy text

\usepackage{atbegshi}

\AtBeginShipout{\AtBeginShipoutAddToBox{%   
\TypesetCoffin\Framex}}

\NewCoffin\Framex
\NewCoffin\Timex
\SetHorizontalCoffin\Timex{\footnotesize{My version of \today{,} \currenttime{.}}}

\begin{document}    
\JoinCoffins*\Framex[l,b]\Timex[l,b](-\oddsidemargin-1in +7ex,\topmargin+\topskip+\headheight+\headsep-\paperheight+1ex) % X Y offsets

1. \kant[1-10]

\end{document}

out

1
  • 1
    It works, thanks so much.
    – mario
    Commented Dec 8, 2020 at 22:22
5

Here are two options: Using eso-pic or the default LaTeX hooks.

  • eso-pic's \AddToShipoutPictureForeground

    \documentclass{article}
    
    \usepackage{lipsum,datetime2}
    
    \usepackage{eso-pic}
    \AddToShipoutPictureFG{%
      \AtPageLowerLeft{%
        \raisebox{.5\baselineskip}
          {\hspace{.5\baselineskip}\footnotesize My version of \DTMtoday, \DTMcurrenttime.}%
      }%
    }
    
    \begin{document}
    
    \sloppy\lipsum[1-50]\lipsum[1-50]
    
    \end{document}
    
  • LaTeX's shipout hooks: \AddToHook{shipout/foreground}

    \documentclass{article}
    
    \usepackage{lipsum,datetime2}
    
    \AddToHook{shipout/foreground}{%
      \put(.5\baselineskip,-\paperheight+.5\baselineskip)
        {\footnotesize My version of \DTMtoday, \DTMcurrenttime.}
    }
    
    \begin{document}
    
    \sloppy\lipsum[1-50]\lipsum[1-50]
    
    \end{document}
    

enter image description here

3
  • The first solution works fine. Thanks a lot. The second on returns a number of errors (even with your MWE).
    – mario
    Commented Dec 8, 2020 at 22:22
  • @mario: It requires an up-to-date LaTeX. There was an Oct 2020 release that includes the new hook management. See LaTeX News Issue 32.
    – Werner
    Commented Dec 8, 2020 at 22:26
  • Ok, I'll check. On my Fedora 32 machine, I use to update by just dnf update texlive. Your first solution works fine.
    – mario
    Commented Dec 8, 2020 at 22:39

You must log in to answer this question.

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