General ⇒ How to place fullpage vertical rule in margin on every page?
How to place fullpage vertical rule in margin on every page?
I'm a LaTeX newbie and I've done a lot of searching but not making any progress. Can anyone help? Thanks.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
How to place fullpage vertical rule in margin on every page?
there are several options. You could try, for example, the background package. A little example (addapt it according to your needs):
Code: Select all
\documentclass{article}
\usepackage{background}
\usepackage{lipsum}% just to generate filler text for the example
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{\rule{.4pt}{\paperheight}}
\SetBgHshift{-9cm}
\begin{document}
\lipsum[1-90]
\end{document}
Re: How to place fullpage vertical rule in margin on every p
I did have someone who responded to my similar question in StackOverlow with tex code to draw the line, but it seems to have a small bug. You can view that answer here: http://stackoverflow.com/questions/2986 ... every-page
Strangely, the tex code draws a line only if I leave your background-package lines active in my document. If I comment them out the tex code gives me an error, won't compile. And even when it does compile and place a line (when background's lines are also printed) the line printed by the tex code is exactly at the left edge of the text area and goes from bottom of text area to top (i.e., height is exactly textwidth).
Thanks again.
-- Herb
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to place fullpage vertical rule in margin on every page?
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage{eso-pic}
\usepackage{calc}
\usepackage{blindtext}
\newlength{\leftrule}
\newlength{\rightrule}
\setlength{\leftrule}{2\leftmargin-\marginparsep}
\setlength{\rightrule}{2\leftmargin+\textwidth+\marginparsep}
\AddToShipoutPicture{%
\AtPageLowerLeft{%
\put(\LenToUnit{\leftrule},0){\rule{1pt}{\paperheight}} % Rule on the left
\put(\LenToUnit{\rightrule},0){\rule{1pt}{\paperheight}} % Rule on the right
}
}
\begin{document}
\blinddocument
\end{document}
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10