0

I have been trying to put smal text to the very top left of the page by using the geometry package and setting the margins to 0, but it doesn't go all the way - there is a slight vspace to the right and the top of the word.

Is there a way to fix this?

\documentclass[a4paper]{article}

\usepackage[margin=0in]{geometry}

\begin{document}
  \fontsize{3pt}{3pt}\selectfont Test.
\end{document}
  • You should not set the margin to 0. You should use some other packages instead. – user156344 Apr 6 at 11:36
  • @JouleV Is there one you'd recommend? – Tomáš Sláma Apr 6 at 11:37
1

If you want to get a small line of text in the corner of the paper, you have many option (but not by using [margin=0pt]{geometry}!) – in this answer I will show the TikZ approach.

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\path (current page.north west) node[below right,inner sep=0pt,font=\fontsize{3pt}{3pt}\selectfont] {This is for test};
\end{tikzpicture}

\lipsum[1-2]
\end{document}

enter image description here

enter image description here

If the very thin space on the top and on the left should not be there, you can set inner sep to a negative number

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\path (current page.north west) node[below right,inner sep=-0.5pt,font=\fontsize{3pt}{3pt}\selectfont] {This is for test};
\end{tikzpicture}

\lipsum[1-2]
\end{document}

or set inner xsep and inner ysep separately

\documentclass[a4paper]{article}

\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]
\path (current page.north west) node[below right,inner xsep=-0.5pt, inner ysep=-0.4pt,font=\fontsize{3pt}{3pt}\selectfont] {This is for test};
\end{tikzpicture}

\lipsum[1-2]
\end{document}

However, for readability, I suggest you should not remove that very thin space.

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.