My code creates a vertical line between the two columns, but I'm not sure how to make it dotted.
\usepackage[automark]{scrlayer-scrpage}
\usepackage[english]{babel}
\usepackage{blindtext}
\PassOptionsToPackage{svgnames}{xcolor}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{calc}
\usepackage[width = 18cm]{geometry}
\usepackage{enumitem}
\newcounter{question}
\newcounter{choice}
\setcounter{choice}{1}
\newcommand{\tikzhead}[1]{%
\begin{tikzpicture}[remember picture,overlay]
\node[yshift=-2.7cm, xshift=-1cm] at (current page.north west)
{\begin{tikzpicture}[remember picture, overlay]
\path[draw=none, fill=lightgray] (2,0) rectangle
(\paperwidth,2cm);
\end{tikzpicture}
};
\end{tikzpicture}}
\clearscrheadings
\ihead{\tikzhead{\headmark}}
\pagestyle{scrheadings}
\newenvironment{question}{%
\stepcounter{question}%
\noindent\colorbox{black}{\textcolor{white}{\makebox[1.5em][c]{\thequestion}}}%
\colorbox{lightgray}{\phantom{\rule{\columnwidth-1.9em-\columnsep}{\heightof{1}}}}\par
\begin{list}{}{%
\setlength\itemindent{0pt}%
\setlength\leftmargin{2em}%
\setlength\rightmargin{1em}%
\setlength\labelwidth{0pt}%
\setlength\labelsep{0pt}}%
\item[]}%
{\end{list}}
\newenvironment{choices}{%
\begin{list}{\Alph{choice})}{%
\setlength\labelwidth{30pt}%
\setlength\itemindent{0pt}%
\setlength\leftmargin{2em}%
\setlength\labelsep{10pt}%
\usecounter{choice}}}%
{\end{list}}
\setlength\columnseprule{0.5pt}
\begin{document}
\pagenumbering{gobble}
\twocolumn
\begin{question}
What is 1 + 2?
\vspace{1.5cm}
\end{question}
\begin{question}
What is 1 + 3?
\vspace{1.5cm}
\end{question}
\begin{question}
What is 1 + 4?
\begin{choices}
\item 1
\item 2
\item 5
\item 6
\end{choices}
\vspace{0.5cm}
\end{question}
\begin{question}
What is 1 + 2?
\vspace{1.5cm}
\end{question}
\begin{question}
What is 1 + 3?
\vspace{1.5cm}
\end{question}
\vspace{5cm}
\begin{question}
What is 1 + 4?
\begin{choices}
\item 1
\item 2
\item 5
\item 6
\end{choices}
\vspace{0.5cm}
\end{question}
\begin{question}
What is 1 + 2?
\vspace{1.5cm}
\end{question}
\begin{question}
What is 1 + 3?
\vspace{1.5cm}
\end{question}
\begin{question}
What is 1 + 4?
\begin{choices}
\item 1
\item 2
\item 5
\item 6
\end{choices}
\vspace{0.5cm}
\end{question}
\begin{question}
What is 1 + 2?
\vspace{1.5cm}
\end{question}
\end{document}```
tikzpictures is unsupported and very likely to cause weird bugs. – cfr Mar 28 '24 at 03:46