2

I can draw a rule across the entire pagewidth with the following command:

\noindent\makebox[\linewidth]{\rule{\paperwidth}{1pt}} 

but I can't draw a dotted line. Any ideas? I need the line to divide the page, ignoring the margin, that is, drawing the dotted line even in the margin area.

0

2 Answers 2

2

Insert a \dotfill:

enter image description here

\documentclass{article}

\usepackage{lipsum}

\newcommand{\dividepage}{%
  \par\noindent
  \makebox[\linewidth]{\raisebox{.2\baselineskip}{\makebox[2\paperwidth]{\dotfill}}}%
  \par
}

\begin{document}

\lipsum[1]

\dividepage

\lipsum[1]

\end{document}

I've raised it slightly to set it in the middle between two paragraphs. For overkill, I've specified 2\paperwidth as the width of the \dotfill as to ensure it will stretch into both margins (and off the page).

2

Here is a tikz solution :

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcounter{SplCounter}

\def\tikzmark#1{\tikz[remember picture]\coordinate(#1);}

\newlength{\yplace}
\newcommand\mySplitter[1][dotted]{%
  \stepcounter{SplCounter}%
  \setlength{\yplace}{\dimexpr\textheight/2-\pagetotal-1.5\baselineskip\relax}%
  \tikzmark{Spl\theSplCounter}%
  \par
  \begin{tikzpicture}[remember picture,overlay]%
  \draw[#1] ([yshift=\yplace,xshift=-\paperwidth/2]current page.center)--([yshift=\yplace,xshift=\paperwidth/2]current page.east);%
  \end{tikzpicture}\par
}

\begin{document}
\lipsum[2]\mySplitter

\lipsum[3]\mySplitter[dashdotted,red,ultra thick]

\lipsum[4]\mySplitter[-,green!34!brown,thick]
Could just write the text here without empty lines... A
new paragraph will start even if I don't want to...

\end{document}

Output:

enter image description here

1
  • Because of the overlay usage you have to compile twice ...
    – koleygr
    Commented Jan 16, 2018 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .