[Tex/LaTex] Making a line-separated left-margin in LaTeX

marginparrules

I'm trying to write a user guide in LaTeX, and I want to layout my page in a way that I can put in a left margin for comments / notes on the corresponding lines of text in the main portion of the page (eg. a pcture of an exclamation mark and some words of caution to the reader about something said in the content on the right).

Furthermore it would be nice if I could somehow get a thin line separating the margin and the main body of text.

I've tried playing around with minipage, but I don't know how to specify the placement of the columns: I can't make the "margin" column align to the left side of the page, minipage always splits the page in half.

EG:

          |  main content of the page
          |  ctd.....................
! Warning |  ctd.....................
          |  ctd.....................
          |  ctd.....................
? Note    |  ctd.....................
          |  ctd.....................

Best Answer

One possible solution would be to use the space reserved for marginal notes to place the comments/notes and to use the background package to place the vertical rule separating the text from the notes/comments; a little example (feel free to adapt and improve my example to suit your needs):

\documentclass{article}
\usepackage{marginnote}
\usepackage{graphicx}
\usepackage{background}
\usepackage{lipsum}% just to generate filler text

% settings for the vertical line
\SetBgScale{1}
\SetBgColor{black}
\SetBgAngle{0}
\SetBgHshift{-0.52\textwidth}
\SetBgVshift{-1mm}
\SetBgContents{\rule{0.4pt}{\textheight}}

\newcommand*\Note{%
  \marginnote[\textcolor{blue}{\raggedright{\LARGE ?}\ Note }]{}%
}
\newcommand*\Warn{%
  \marginnote[\textcolor{red}{\raggedright{\LARGE !}\ Warning }]{}%
}
\reversemarginpar

\begin{document}
some test text\Note{sdfasdfdsfsd} \lipsum[1]
\Warn{sdfasdfdsfsd} \lipsum[1]
\end{document}

A portion of the resulting document:

enter image description here