I want to display a vertical line in the middle of my document. For creating the line I use tikz and for adjusting a margin I use adjustbox.

\documentclass[a4paper,12pt]{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{noto-sans}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{geometry}
\geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}

\usepackage{showframe}

\setlength{\parindent}{0cm}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]

\adjustbox{margin*=0cm 1cm 1cm 0cm}{
\fill[black] (current page.north) rectangle ([xshift=0.1cm]current page.south);
}

\end{tikzpicture}
\end{document}


Unfortunately, the margin is either applied to the bottom OR to the top. But not both.

Regards Andi

• Does the margin mean that the line starts one cm below the top and ends one cm above the bottom? If so, just do \draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);. – marmot May 27 '18 at 20:33
• @marmot Thank you very much! Thats exactly what I wanted. – AndiLeni May 27 '18 at 20:49
• Also, adding \adjustbox inside a tikzpicture does not work as indented. You need to apply it around it. – Martin Scharrer Dec 29 '18 at 8:46
• @marmot: Please post your comment as an answer, so that AndiLeni can accept it to conclude the question. – Martin Scharrer Dec 29 '18 at 8:47
• @MartinScharrer Done, thanks for pinging me. – marmot Dec 29 '18 at 9:09

From my above comment.

\documentclass[a4paper,12pt]{article}

\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{noto-sans}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{geometry}
\geometry{
a4paper,
lmargin=0mm,
rmargin=0mm,
tmargin=0mm,
bmargin=0mm,
}

\usepackage{showframe}

\setlength{\parindent}{0cm}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\draw[line width=1mm] ([yshift=-1cm]current page.north) -- ([yshift=1cm]current page.south);
\end{tikzpicture}
\end{document}


• Please add the comment text into your answer (maybe modified a little), so that the answer is selfcontaining. – Martin Scharrer Dec 29 '18 at 9:14

I think this task is easier with eso-pic:

\documentclass[a4paper,12pt]{article}

\usepackage{eso-pic}