边注不在正文旁边

边注不在正文旁边

早上好。

我想在文本旁边添加边注。当我这样做时,它是正确的,但是当我编写文本时,边注会改变位置(下图)。如何修复它?

感谢帮助。

\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 [email protected]@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}

在此处输入图片描述

答案1

正如 David Carlisle 和 Mico 所说,你应该把边注放在靠近文本的位置。但我想提出另一种解决方案,灵感来自代码清单的背景图片

在你想要的任何地方创建一个 tikz 节点,然后将你的边注附加到它上面。

\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 [email protected]@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}

在此处输入图片描述

相关内容