Marginpar/Marginnote hint to column

Sorry, but until someone comes up with a better title, I have to stick to this one for my question. I am currently using \marginnote for the first time in Latex and I want to use it on a twocolumn, twoside document. The best way to go for me is to place all margin notes on the outside, which works well so far. However I want to add a visual aid to show if the note corresponds to the inner or outer column. If the note belongs to the outer column, no hint should be given. If the note belongs to the inner column, an arrow (or a similar guide) should be displayed. The following image provides an example what it would look like on an odd page:

Can you show me how to use a marginpar or marginnote (or whatever) that accomplishes this automatically (or at least after some command definitions)?

1 Answer

You can use \if@firstcolumn to detect which column you are in and if true print an extra symbol. The easiest place to hook in is the \raggedrightmarginnote macro

\documentclass[twocolumn]{article}

\usepackage[margin=3cm,marginparwidth=2cm]{geometry}
\usepackage{marginnote}

\edef\marginnotetextwidth{\the\textwidth}

\makeatletter
\renewcommand*{\raggedrightmarginnote}{\raggedright\if@firstcolumn$$\triangleleft$$ \fi}
\makeatother

\usepackage{lipsum} %For dummy text

\begin{document}

\lipsum[1]
\marginnote{First note}

\lipsum[2-4]
\marginnote{Second note}

\lipsum[5-6]
\end{document}