TransWikia.com

Text taking up no space

TeX - LaTeX Asked on May 3, 2021

I want to typeset some text while LaTeX ignores the space that the text will take. In the MWE below using a zero-sized picture accomplishes that while using a raisebox does not.

 % nospacetextprob.tex
documentclass{report} % but could be book, article, etc
usepackage{picture}
usepackage{lipsum}

newcommand{shiftpic}{begin{picture}(0,0)put(0,-1.1textheight){textbf{shiftpic}}end{picture}}
newcommand{shifttext}{raisebox{-1.1textheight}{textbf{shifttext}}}

begin{document}
shiftpic 
%  hspace{6em} shifttext
lipsum[1-3]
end{document}

Both shiftpic and shifttext are meant to put their argument below the textheight. shiftpic works well but shifttext adds a couple of pages to the document.

I have vague memories of some TeX code that nullifies the vertical space taken up by some text. Call it nospace so nospace{shiftit} would work like shiftpic. Can someone please remind me of it?

One Answer

You have to nullify the height and depth, but also the width.

documentclass{report} % but could be book, article, etc
usepackage{picture}
usepackage{lipsum}

newcommand{shiftpic}{begin{picture}(0,0)put(0,-1.1textheight){textbf{shiftpic}}end{picture}}
newcommand{shifttext}{makebox[0pt][l]{raisebox{-1.2textheight}[0pt][0pt]{textbf{shifttext}}}}

begin{document}
shiftpicshifttext
lipsum[1-3]
end{document}

enter image description here

Answered by egreg on May 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP