如何使用 tikz 包制作边注?

如何使用 tikz 包制作边注?

我想制作这样的边注

在此处输入图片描述

在此处输入图片描述

但它们的行为应该像\marginnote命令一样。我想要这个的原因是当我想修改内容的显示方式时包的灵活性tikz(例如,框、背景、对齐、透明度、锚点等)

平均能量损失

\documentclass{book}

\usepackage[a4paper]{geometry}
% BEGIN_FOLD

\geometry{twoside=true, showframe=true}
\geometry{inner=5mm, outer=5mm, includemp=true, marginparsep=3.5mm, marginparwidth=61mm}

% END_FOLD

\usepackage{blindtext}

\usepackage{bigstrut}

\usepackage{tikz,tikzpagenodes}

\usepackage{marginnote}


\begin{document}

\noindent%
\begin{tikzpicture}[baseline, remember picture, overlay]
    
    \node[text width=61mm, align=flush left, inner xsep=0pt, inner ysep=1pt, outer xsep=0pt, outer ysep=0pt, anchor=north east] at (current page marginpar area.north east) {\bigstrut \blindtext};
    
\end{tikzpicture}%
%
\smash{\rlap{\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
\blindtext
    
\newpage

\noindent%
\begin{tikzpicture}[baseline, remember picture, overlay]
    
    \node[text width=61mm, align=flush left, inner xsep=0pt, inner ysep=1pt, outer xsep=0pt, outer ysep=0pt, anchor=north east] at (current page marginpar area.north east) {\bigstrut \blindtext};
    
\end{tikzpicture}%
%
\smash{\rlap{\hspace*{\dimexpr - \marginparsep - \marginparwidth \relax}\rule{\dimexpr \linewidth + \marginparsep + \marginparwidth \relax}{0.1pt}}}%
\blindtext

\newpage

\marginnote{\blindtext}%
\blindtext

\end{document}

相关内容