0

I would like to write numbers into the left margin. The package marginnote does not work, presumably, because I use paracol (?) My solution at the moment is an ugly macro \para, which uses a (0,0)-size picture and \llap to write text on the left margin.

This works, however fails to align the numbers properly, when used inside a enumerate/itemize-environment. Any idea how to make sure that the text is always at the same horizontal position, say 0.7 cm left of the text?

Thanks a lot for any ideas or suggestions!

MWE:

mwe

\documentclass{article}

\usepackage[a4paper, left=2.0cm, right=2.0cm]{geometry}

\setlength{\parindent}{0cm}
\usepackage{paracol}

\newcounter{paranumber}
\globalcounter{paranumber}

\newcommand{\para}[0]{
\refstepcounter{paranumber}
\setlength{\unitlength}{1cm}
\begin{picture}(0.0,0.0)
\put(0,0){\llap{\makebox[7mm][l]{\textbf{\theparanumber}}}}
\end{picture}}

\begin{document}

\columnratio{0.6,0.4}
\setlength{\columnsep}{1.5cm}
\begin{paracol}{2}
\begin{nthcolumn}{0}

\para Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum.

At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\\

\para Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua.

\end{nthcolumn}
\begin{nthcolumn}{1}

\begin{itemize}
\item \para This is item 1
\item This is item 2
\item This is item 3\para
\end{itemize}

\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.

\end{nthcolumn}
\end{paracol}

\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.

\end{document}
0

This solution uses tikzpagenodes, at least for the text area. When paracol is used it uses \pcol@currcol to determine which column it is in. Otherwise is checks the current x location. It can handle more than 2 columns.

Remember, it takes two runs before tikz know where it is on the page.

\documentclass{article}

\usepackage[a4paper, left=2.0cm, right=2.0cm]{geometry}

\setlength{\parindent}{0cm}
\usepackage{paracol}
\usepackage{tikzpagenodes}

\newcounter{paranumber}
\globalcounter{paranumber}
\newlength{\paradist}
\newlength{\paraleft}
\newcount{\paracount}

\makeatletter
\newcommand{\para}[0]{%
  \refstepcounter{paranumber}%
  \begin{tikzpicture}[overlay,remember picture]%
    \coordinate (here) at (0,0);
    \pgfextractx{\paradist}{\pgfpointdiff{\pgfpointanchor{current page text area}{west}}%
      {\pgfpointanchor{here}{center}}}% distance to left side of text area
    \paraleft=0pt
    \ifnum\col@number=1\relax% single column or paracol
      \@ifundefined{pcol@currcol}% paracol not loaded
       {\node[anchor=base east] at (current page text area.west |- here)
         {\makebox[7mm][l]{\textbf{\theparanumber}}};}%
       {\paracount=0
        \loop\ifnum\paracount=\pcol@currcol\relax%
          \node[anchor=base east,xshift=\paraleft] at (current page text area.west |- here)
            {\makebox[7mm][l]{\textbf{\theparanumber}}};
        \else
          \advance\paraleft by \csname pcol@columnwidth\number\paracount\endcsname
          \advance\paraleft by \csname pcol@columnsep\number\paracount\endcsname
          \advance\paracount by 1
        \repeat}
    \else% multicol or twocolumn
      \loop\ifnum\paradist<\dimexpr \paraleft+\columnwidth+0.5\columnsep\relax
        \node[anchor=base east,xshift=\paraleft] at (current page text area.west |- here)
          {\makebox[7mm][l]{\textbf{\theparanumber}}};
      \else
        \advance\paraleft by \columnwidth
        \advance\paraleft by \columnsep
      \repeat
    \fi%
  \end{tikzpicture}%
}
\makeatother

\begin{document}

\columnratio{0.6,0.4}
\setlength{\columnsep}{1.5cm}
\begin{paracol}{2}
\begin{nthcolumn}{0}

\para Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum.

At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\\

\para Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua.

\end{nthcolumn}
\begin{nthcolumn}{1}

\begin{itemize}
\item \para This is item 1
\item This is item 2
\item This is item 3 \para
\end{itemize}

\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.

\end{nthcolumn}
\end{paracol}\leavevmode

\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.

\end{document}
  • I'm trying to improve it to use code from paracol an multicol. Also, currently it won't work inside a minipage. – John Kormylo Jul 17 '16 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.