4

My question concerns the margin notes and particularly its position in the page.

Is it possible that margin notes have an absolute horizontal position but a vertical position that depends on the part of the text the margin note is inserted ?

Precisely I want that margin notes have :

  • an absolute horizontal position (given for example in centimeters)

  • a vertical position that is centered on the middle of a part of a text (for example delimited by an environment);

and which depend on odd/even pages.

The minimal example given below also includes a "vrule" that I wanted to by adapted to the text it depends on (absolute horizontal and relative vertical positions). I think the first part of my question would answer this part.

For the moment I tried to play with \raggedrightmargin... but without a "good" result and tried some solution on this website.

I hope that I am clear and I thank you by advance for your answers.

    \documentclass[9pt]{extarticle}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\usepackage[absolute]{textpos}
\textblockorigin{0pt}{0pt}

\usepackage[papersize={15cm,21cm},top=1cm, bottom=1.5cm, left=1cm , right=1cm,twoside,marginparsep=0cm]{geometry}%dimensions customisées de la page

\newtheorem{ex}{Example}

\newcommand{\cexemple}[1]{\begin{minipage}{13cm}#1\end{minipage}}

\usepackage[fulladjust]{marginnote}

\renewcommand*{\raggedrightmarginnote}{\hspace{-1.8cm}}
\renewcommand*{\raggedleftmarginnote}{\hspace{-0.8cm}}

\begin{document}

\newgeometry{inner=1cm, outer=3cm, top=1cm, bottom=1.5cm,twoside,bindingoffset=0pt,marginparsep=0cm}

\noindent\hspace{-0.3cm}\cexemple{\begin{ex}\lipsum[5]\end{ex}}

\medskip

\marginnote{\small\textit{\begin{minipage}{2.1cm}This is a long margin note.\end{minipage}}}[0cm] \lipsum[4]

\begin{textblock*}{40pt}(345pt,120pt)
\vrule width 0.5pt height 2.8cm
\end{textblock*}

\newpage

\noindent\hspace{-2cm}\cexemple{\begin{ex} \lipsum[5]\end{ex}}

\medskip

\noindent  This text include a margin note \marginnote{\small\textit{\begin{minipage}{2.1cm}This is another long margin note.\end{minipage}}}[0cm] that we have to align properly. 

\begin{textblock*}{40pt}(55pt,120pt)
\vrule width 0.5pt height 1cm
\end{textblock*}

\end{document}

Your Answer

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

Browse other questions tagged or ask your own question.