Page Layouttwo-column with margins on the same (left) side

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
hyc_n
Posts: 5
Joined: Thu Aug 30, 2012 9:45 am

two-column with margins on the same (left) side

Post by hyc_n »

I am making a two-column document using multicol package.
I need a vertical rule to the left of each column.
I have a macro, say \foo, which appears in the text. When a \foo appears, a counter is increased and printed on the margin (i.e. on the left of the vertical rule to the left of that line).
It is possible that two \foo s appears on the same line, and in that case two numbers has to be printed on the same line of margin.

Code: Select all

\documentclass{article}
\newcount\cntr
\def\foo{\llap{\rule[6pt]{2pt}{2pt}\hskip1pt}\advance\cntr by 1\bar}
\def\bar{}% print the \cntr on the left of that line.
\usepackage{multicol}
\columnsep=40pt
\begin{document}
\begin{multicols}{2}
\leavevmode \foo Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \foo Ut purus elit, vestibulum, placerat ac, adipiscing vitae, felis. \foo Curabitur mauris. \foo Nam arcu libero, \foo nonummy gravida eget, consectetuer id, vulputate a, magna. 
\end{multicols}
\end{document}
The following figure is the result that I want. (Black matters are from pdflatex output, and those red matters are added to the output.)
Image
Note that the paragragh on column 2 is shorter and the vertical rule for that column is also shorter.

I have no idea how to finish this task. can anyone help? Thank you very much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply