I have a document where I would like a narrow vertical rule running the length of the page about 0.5 in from left edge of the paper. I would like for this rule to appear automatically on every page, so I assume it somehow needs to be tied to a header or footer.
I'm a LaTeX newbie and I've done a lot of searching but not making any progress. Can anyone help? Thanks.
General ⇒ How to place fullpage vertical rule in margin on every page?
How to place fullpage vertical rule in margin on every page?
Hi,
there are several options. You could try, for example, the background package. A little example (addapt it according to your needs):
there are several options. You could try, for example, the background package. A little example (addapt it according to your needs):
Code: Select all
Code, edit and compile here:
\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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: How to place fullpage vertical rule in margin on every p
gmedian -- Thanks so much! That works great, and was easy to modify to have one rule in left margin and one in right. I don't so much like fact that it can't all be done in preamble, but I put it all in a newcommand in preamble so at least it can be turned on with a quick short command outside the preamble.
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
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?
There is another solution that uses the eso-pic package.
Best regards and welcome to the board
Thorsten
Code: Select all
Code, edit and compile here:
\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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10