1

Good morning.

I would like to get margin notes next to text. When I do it it's right but when I write a text margin notes change position (the picture below) . How to fix it?

Thanks for help.

\documentclass[10pt,a6paper]{book}
%46paper
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}

\usepackage{marginnote}
\usepackage[top=10mm, bottom=10mm, outer=30mm, inner=10mm, heightrounded, marginparwidth=25mm, marginparsep=2mm]{geometry}

\usepackage{tipa}
\usepackage{multirow}
\usepackage{color}
\usepackage{longtable}
\usepackage[dvipsnames]{xcolor}
%\pagenumbering{alph}
%\pagenumbering{Roman}
%\usepackage{tgbonum} 

\begin{document}
\catcode`\-=12
\sloppy

%\tableofcontents
%\thispagestyle{empty}

    \underline{\texttt{Proces merania}}
\begin{enumerate}
  \item \texttt{meranie, pozorovanie}
  \item \texttt{výpočet}
  \item \texttt{analýza}
\end{enumerate}
\vspace{5mm}

\underline{\texttt{Pozorovania}}
\begin{enumerate}
  \item \texttt{priame}
  \item \texttt{nepriame}
\end{enumerate}

$$ E= X - \bar{X} $$
\begin{longtable}{lp{5cm}}
  $\bar{X}$  & skutočná hodnota,veľkosť meranej veličiny\\
  X          & nameraná, odmeraná hodnota veličiny\\
  E          & chyba v nameranej, odmeranej hodnove veličiny\\
\end{longtable}


\marginnote{{\footnotesize
  {\color{TealBlue} \foreignlanguage{English}{observation}}  [\textipa{\textsecstress 6b.z@\textprimstress veI.S\super @n}]\\
                                  \foreignlanguage{slovak}{pozorovanie} \\ 
  {\color{TealBlue} \foreignlanguage{English}{measurement}} [\textipa{\textprimstress meZ.@.m@nt}]\\
                                  \foreignlanguage{slovak}{meranie \textit{(of) čoho}}\\
  {\color{TealBlue} \foreignlanguage{English}{to analyse}}   [\textipa{\textprimstress \ae n.\super @l.aIz}]\\
                                  \foreignlanguage{slovak}{analyzovať \textit{čo}}\\\vspace{10mm}
  {\color{TealBlue} \foreignlanguage{English}{directly}}  [\textipa{daI\textprimstress rekt.li}]\\                                  \foreignlanguage{slovak}{priamo, bezprostredne} \\ 
  {\color{TealBlue} \foreignlanguage{English}{indirectly}} [\textipa{\textsecstress In.daI\textprimstress rekt.li}]\\
                       \foreignlanguage{slovak}{nepriamo}\\         
}}

\end{document}

enter image description here

  • 2
    Have you considered placing the \marginnote material before the material in the body of the document? – Mico Oct 10 '16 at 6:29
  • 3
    marginal notes are positioned close to the text where you add them so here they come at the end of the document as you added them at the end, latex hasn't moved them there. – David Carlisle Oct 10 '16 at 6:43
2

As David Carlisle and Mico said, you should put the marginal notes close to the text where you want to be there. But I want to suggest another solution inspired by Background images for code listings.

make a tikz node everywhere you want and then attach your marginnote to it.

\documentclass[10pt,a6paper]{book}
%46paper
\usepackage[utf8]{inputenc}
\usepackage[main=english,slovak]{babel}
\usepackage[cm]{fullpage}

\usepackage{marginnote}
\usepackage[top=10mm, bottom=10mm, outer=30mm, inner=10mm, heightrounded, marginparwidth=25mm, marginparsep=2mm]{geometry}

\usepackage{tipa}
\usepackage{multirow}
\usepackage{color}
\usepackage{longtable}
\usepackage[dvipsnames]{xcolor}
%\pagenumbering{alph}
%\pagenumbering{Roman}
%\usepackage{tgbonum} 

\usepackage{tikz}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\putaside}[2]{
    \begin{tikzpicture}[overlay,remember picture]
        \node at ({#1}.east) {#2};
    \end{tikzpicture}
}    

\begin{document}
\catcode`\-=12
\sloppy

%\tableofcontents
%\thispagestyle{empty}

\tikzmark{testmark}
    \underline{\texttt{Proces merania}}
\begin{enumerate}
  \item \texttt{meranie, pozorovanie}
  \item \texttt{výpočet}
  \item \texttt{analýza}
\end{enumerate}
\vspace{5mm}

\underline{\texttt{Pozorovania}}
\begin{enumerate}
  \item \texttt{priame}
  \item \texttt{nepriame}
\end{enumerate}

$$ E= X - \bar{X} $$
\begin{longtable}{lp{5cm}}
  $\bar{X}$  & skutočná hodnota,veľkosť meranej veličiny\\
  X          & nameraná, odmeraná hodnota veličiny\\
  E          & chyba v nameranej, odmeranej hodnove veličiny\\
\end{longtable}


\putaside{testmark}{
\marginnote{{\footnotesize
  {\color{TealBlue} \foreignlanguage{English}{observation}}  [\textipa{\textsecstress 6b.z@\textprimstress veI.S\super @n}]\\
                                  \foreignlanguage{slovak}{pozorovanie} \\ 
  {\color{TealBlue} \foreignlanguage{English}{measurement}} [\textipa{\textprimstress meZ.@.m@nt}]\\
                                  \foreignlanguage{slovak}{meranie \textit{(of) čoho}}\\
  {\color{TealBlue} \foreignlanguage{English}{to analyse}}   [\textipa{\textprimstress \ae n.\super @l.aIz}]\\
                                  \foreignlanguage{slovak}{analyzovať \textit{čo}}\\\vspace{10mm}
  {\color{TealBlue} \foreignlanguage{English}{directly}}  [\textipa{daI\textprimstress rekt.li}]\\                                  \foreignlanguage{slovak}{priamo, bezprostredne} \\ 
  {\color{TealBlue} \foreignlanguage{English}{indirectly}} [\textipa{\textsecstress In.daI\textprimstress rekt.li}]\\
                       \foreignlanguage{slovak}{nepriamo}\\         
}}
}

\end{document}

enter image description here

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.