TransWikia.com

How to position the timestamp with tikzpicture but not change the position of texts?

TeX - LaTeX Asked by Keric on April 17, 2021

I am using tikzpicture to put a timestamp in my article, and everthing seems to be good. However, once I compile the tikzpicture, the text would sink and I don’t expect that such a blank at the beginning. How can I fix it or using an alternative rather than tikzpicture?

Here is my code:

documentclass[a4paper]{article}
usepackage[long]{datetime}
usepackage{framed}
usepackage{float}
usepackage{tikz}
usetikzlibrary{graphs}
usetikzlibrary{positioning}
usepackage{setspace}

title{textbf{Title}}
author{textbf{Name:} Alan}
date{textbf{Date of Meeting:} formatdate{18}{2}{2021}}

begin{document}
maketitle
thispagestyle{fancy}

begin{tikzpicture}[remember picture, overlay]
    node[anchor=north east, inner sep=0.5cm] at (current page.north east)
    {fontsize{7}{7}selectfont Latest edited at currenttime  on today};
end{tikzpicture}

begin{framed}
    noindent
    textbf{ABC:} abcs.
end{framed}

section{11}

end{document}

enter image description hereenter image description here

You may see the spacing between the date and the frame is different because of the tikzpicture.

One Answer

In your case the simplest solution is to put the tikzpicture environment at the end of maketitle. Put the code below in the preamble:

usepackage{etoolbox}
apptocmd{maketitle}{
 begin{tikzpicture}[remember picture, overlay]
 node[anchor=north east, inner sep=0.5cm] at (current page.north east)
 {fontsize{7}{7}selectfont Latest edited at currenttime  on today};
 end{tikzpicture}
}{}{}

Answered by Ivan on April 17, 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