2

I need to write a text at the bottom of the page, out of the margin. In the example below the text at the bottom should stay at 0.5cm from the border, even using the standard margins of Latex. I need it just for a single page and for a single line.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[bottom=0.5cm]{geometry}
\usepackage{showframe}
\thispagestyle{empty}

\begin{document}
\lipsum[1-4]
\vfill
{\scriptsize \noindent \lipsum[1][1-2]} 
\end{document} 
3
  • 1
    Just for a single page, or an all pages?
    – Werner
    Commented Jan 3, 2021 at 5:33
  • How much text do you need to place at the bottom of the page? Just a couple of words, at most 1 line? Please clarify
    – Mico
    Commented Jan 3, 2021 at 9:55
  • Sorry for the lack of clarity. Just for a single page and 1 line.
    – s1m0n3
    Commented Jan 3, 2021 at 11:13

2 Answers 2

3

xcoffins is a package that emulates a layout program. You put your content into boxes and stitch them together in various ways, adding vertical and horizontal offsets as needed.

Then write the result, which is itself a text object, at the current insertion point, in this example, at the beginning of the page, before \lipsum[1-4].

\Framex acts as a frame, picking up and placing the other box \Textx using their relative positions. With (X= 0pt, Y= -709pt+5mm) puts it at 5mm from the bottom of the page

It is possible to calculate the distance between the insertion point and the bottom of the page, but being a one-time occasion, it is easier to manually adjust the Y offset until you get the desired result.

I did not use geometry to show that the content can be placed anywhere outside the document margins. Using Y = -709pt you will touch the bottom of the page.

So, if you want to be exactly 0.5cm above, use the package calc and put -709pt + 0.5cm as Y offset.

To calculate exactly the Y displacement it is necessary to subtract several lengths from the `\paperheight' and then add the 0.5mm.

This is done in the commented second \Join. As I said, it is faster to do it manually, as you will do it in a GUI of a layout program.

xc

This is the code:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
%\usepackage[bottom=5mm]{geometry} % not used
\usepackage{showframe}
    
\usepackage{calc}   %added  
\usepackage{xcoffins} %added

\NewCoffin\Framex
\NewCoffin\Textx

\thispagestyle{empty}

\begin{document}        

\SetVerticalCoffin\Textx{\textwidth}{% a box of width= \textwidth
\scriptsize \noindent \lipsum[1][1-2]}  

\JoinCoffins*\Framex[l,t]\Textx[l,b](0pt,-709pt+5mm) % X and Y offset manually done

%\JoinCoffins*\Framex[l,t]\Textx[l,b](0pt,-\paperheight+\topskip+\headheight+\headsep+\topmargin+1.0in+5mm) % Y offset calculated

\noindent\TypesetCoffin\Framex  \vspace*{-\baselineskip} % typeset the text at the bottom of the page + 5mm up
    
\lipsum[1-4]

\end{document} 

A similar result can be obtained using eso-pic

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
%\usepackage{geometry} % not used
\usepackage{showframe}

\thispagestyle{empty}
    
\usepackage{eso-pic}

\begin{document}
\AddToShipoutPicture*{%
\AtPageLowerLeft{%      
    \put(125.3,15){\parbox{\textwidth}{\scriptsize \noindent \lipsum[1][1-2]}}%
}%
}           
        
\lipsum[1-14]   
\end{document} 
3
  • Thanks. The eso-pic solution works better because if you have some text at the bottom of the page like text \hfill text the xcoffins solution will leave a small vertical space from the bottom margin.
    – s1m0n3
    Commented Jan 3, 2021 at 18:20
  • Thank you for the feedback! Commented Jan 3, 2021 at 18:47
  • 1
    @s1m0n3 The advantage of xcoffins is appreciated when building larger structures, combining several boxes: text, figures, tables, etc as in a title page. Commented Jan 3, 2021 at 18:56
0

To me this looks like a special page style and indeed one can use page styles to achieve the result. The following uses the package scrlayer-scrpage. It does this

  1. Copy the empty page style, could be any other, though, depending on your needs.
  2. Define a layer which puts the desired text at the desired place.
  3. Add the new layer to the copied page style
  4. Set the desired page style on the page where it should be.

(The new page style could be used several times, of course…)

Here is the complete code:

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[showframe]{geometry}

\usepackage{scrlayer-scrpage}
\DeclarePageStyleAlias{special}{empty}
\DeclareNewLayer[
  textarea ,
  align = b ,
  voffset = \paperheight-5mm ,
  contents = {\scriptsize\noindent\lipsum[1][1-2]}
  ]{specialfooter}
\AddLayersToPageStyle{special}{specialfooter}

\pagestyle{plain}

\begin{document}

\thispagestyle{special}
\lipsum[1-13]

\end{document}

enter image description here

You must log in to answer this question.

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