# Error while adding a dashed line (vertical) for all pages (except the first page)

I want to create a dashed line for the complete document that should begin after the margin (in my example I set it 3cm towards the left edge of the paper). I found this post and tried to use it for my code by replacing the rule with dashrule, but he tells me that there is the following error including it:

Missing number, treated as zero. \lipsum[1-10]
Missing number, treated as zero. \lettergroup{\begin{turn}{270} B \end{turn}}
Missing number, treated as zero. \lettergroup{C}
Missing number, treated as zero. \lettergroup{D}
Missing number, treated as zero. \lettergroup{E}
Missing number, treated as zero. \lettergroup{F}
Missing number, treated as zero. \lettergroup{G}
Missing number, treated as zero. \end{document}
usage of obsolete package!(scrpage2) Package scrpage2' is obsolete.
seems you are using a constant headheight.
Font shape OT1/cmss/bx/sl' undefined(Font) using OT1/cmss/bx/n' instead
Some font shapes were not available, defaults substituted.
Label(s) may have changed. Rerun to get cross-references right.


Sadly I have no idea what TeX tries to tell me with that error.

This is what I inserted (when it starts failing):

% everypage
\usepackage{everypage}
\usepackage[absolute]{textpos}
\usepackage{dashrule}

% for some blindtext
\usepackage{lipsum}

\begin{document}

\ifnum\thepage>1
\begin{textblock}{1,21}(3.5,7)
\hdashrule[0.5ex]{0.2pt}{\pageheigth}
\end{textblock}
\fi
}

%This part usually works but fails as I insert the code above
\lettergroup{\begin{turn}{270} A \end{turn}}

\section{A}
\lipsum[1-10]


The complete code:

\documentclass[a4paper]{article}

\usepackage[
%bindingoffset=0.2in,%
left=3cm,right=3cm,top=3cm,bottom=3cm,%
footskip=.25in]{geometry}

% load TikZ to draw the boxes
\usepackage{tikz}
\usetikzlibrary{calc}

% use scrpage2 or whatever you want to add
% the boxes to the header to make them appear
% on every page
\usepackage{scrpage2}

% rotation of letters for some cool styles
\usepackage{rotating}

% format colors
\usepackage{xcolor}

\definecolor{biffyellow}{RGB}{255,230,0}
\definecolor{pagebackground}{RGB}{243, 244, 239}%243, 239, 244}

%format page-background
\pagecolor{pagebackground}

% new counter to hold the current number of the
% letter to determine the vertical position
\newcounter{letternum}
% newcounter to set the number of thumbs fitting vertical
% and setting the height of a boxes
\newcounter{letterdiv}
\setcounter{letterdiv}{6}
% some margin settings
\newlength{\thumbtopmargin}
\setlength{\thumbtopmargin}{0.5cm}
\newlength{\thumbbottommargin}
\setlength{\thumbbottommargin}{0.5cm}
% calculate the box height by dividing the page height
\newlength{\thumbheight}
\pgfmathsetlength{\thumbheight}{%
(\paperheight-\thumbtopmargin-\thumbbottommargin)%
/%
\value{letterdiv}
}
% box width
\newlength{\thumbwidth}
\setlength{\thumbwidth}{1cm}
% style the boxes
\tikzset{
thumb/.style={
fill=biffyellow,
text=black,
minimum height=\thumbheight,
text width=\thumbwidth,
outer sep=0pt,
font=\sffamily\bfseries\Huge,
inner xsep=1.5em,
}
}
% create two new commands to make the thumbs
% that makes it easy to use them im different header elements,
% like in the plain and normal page style etc.
\newcommand{\evenpageletterthumb}[1]{%
\begin{tikzpicture}[remember picture, overlay]
\node [thumb,align=left,anchor=north west,] at ($% (current page.north west)-% (0,{\thumbtopmargin+(\value{letternum}-1)*\thumbheight})%$) {#1};
\end{tikzpicture}
}
\newcommand{\oddpageletterthumb}[1]{%
\begin{tikzpicture}[remember picture, overlay]
\node [thumb,align=right,anchor=north east,] at ($% (current page.north east)-% (0,{\thumbtopmargin+(\value{letternum}-1)*\thumbheight})%$) {#1};
\end{tikzpicture}
}
% create a new command to set a new lettergroup
\newcommand{\lettergroup}[1]{%
% but I recommend to start a new page
\clearpage
% set a title (optional)
%{\Huge\bfseries\sffamily #1}\par\bigskip
% check if we reached the last vertical position and reset it
\ifnum\value{letternum}=\value{letterdiv}\relax
\setcounter{letternum}{0}%
\fi
% check if we reached the last vertical position and reset it
\ifnum\value{letternum}=\value{letterdiv}\relax
\setcounter{letternum}{0}%
\fi
\stepcounter{letternum}%
% use one head or foot element to put in the box
% it doesn't matter which you use since the box
% is positioned on the page absolutely
}

% customize sections format
\usepackage{titlesec}

\titleformat{\section}
{\Huge\bfseries\sffamily}
{\thesection}{1em}{}

%suppress page numbering
\pagenumbering{gobble}

%
%
% My routine starts here
%
%

% everypage
\usepackage{everypage}
\usepackage[absolute]{textpos}
\usepackage{dashrule}

% for some blindtext
\usepackage{lipsum}

\begin{document}

\ifnum\thepage>1
\begin{textblock}{1,21}(3.5,7)
\hdashrule[0.5ex]{0.2pt}{\pageheigth}
\end{textblock}
\fi
}

\lettergroup{\begin{turn}{270} A \end{turn}}

\section{A}
\lipsum[1-10]

\lettergroup{\begin{turn}{270} B \end{turn}}
\lipsum[1]

\lettergroup{C}
\lipsum[1]

\lettergroup{D}
\lipsum[1]

\lettergroup{E}
\lipsum[1]

\lettergroup{F}
\lipsum[1]

\lettergroup{G}
\lipsum[1]

\end{document}

• Welcome! You have misspelt 'height' and you have not followed the syntax of the \hdashrule command which takes 3 mandatory arguments - not 2. And what is supposed to define \pageheight, once the spelling is corrected? And if you 'gobble' te page numbers, how do you expect TeX to evaluate a conditional which depends on the page number? – cfr Jul 1 '18 at 23:59
• Also, the syntax of textblock is wrong: first mandatory argument should be a dimension. – cfr Jul 2 '18 at 0:16

First, I minimised your example. All the TikZ stuff and the section formatting and so on was irrelevant to the question. There were multiple issues with the remaining code:

• nothing defined either \pageheigth or \pageheight;
• the syntax of \hdashrule and textblock were both wrong;
• you cannot do \pagenumbering{gobble} if you want to do \ifnum\thepage<1 as you've gobbled the \thepage you ask TeX to test;
• \hdashrule produces a horizontal dashed rule - not a vertical one.

I was not always able to discern your intent. In the following:

• I use \paperheight, but you might have wanted textheight;
• I amend the syntax of \hdashrule and textblock so the code compiles and produces a dashed vertical line in the left margin after the first page, but you will need to use this as a template and substitute in the values you want;
• I removed the gobbling;
• I turned the rule.

If you just want not to print page numbers use \pagestyle{empty} and/or \thispagestyle{empty} or redefine the footers, if you want headers as your code suggests. It is hard to guess what's wanted here. You might better test the underlying counter than its textual representation, but it would still be a bad idea to gobble all numbering.

Note that your original code also resulted in a lot of warnings from KOMA. KOMA script packages don't get on well with geometry or titlesec, so consider using what KOMA suggests or use titleps for headers and footers.

Anyway, this does something a bit like what you might want:

\documentclass[a4paper]{article}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm,footskip=.25in]{geometry}

% rotation of letters for some cool styles
\usepackage{rotating}

% everypage
\usepackage{everypage}
\usepackage[absolute]{textpos}
\usepackage{dashrule}

% for some blindtext
\usepackage{lipsum}

\begin{document}

\ifnum\thepage>1
\begin{textblock}{1}[0,0](0.8,0)
\begin{turn}{270}\hdashrule[0pt]{\paperheight}{1pt}{3pt}\end{turn}
\end{textblock}%
\fi
}

\section{A}
\lipsum[1-20]

\end{document}


Note that if you are loading tikz anyway, you might as soon use that and do away with textpos altogether. See also the background` package, which might make a good deal of this easier.