marginnote 软件包问题

marginnote 软件包问题

我有这些烦恼margin notes。这是代码:

\documentclass[openany]{book}
\usepackage{color,xcolor}
\usepackage{marginnote}
\usepackage{lipsum}
\usepackage[colorlinks=true]{hyperref}

\title{Margin Notes}
\author{PUCK}
\date{May 2023}

\begin{document}

\maketitle

\section{Introduction}

\lipsum[1-1]\footnote{Bla bla bla.} \marginnote{\textcolor{blue}{1. } I'd like that this \textit{marginnote} starts at the same line of \textit{Lorem ipsum} ... and I'd like that a number \textcolor{blue}{1.} appears in same position of the footnote but with color blue.}

\lipsum[2-2]\footnote{Bla bla bla.}
\marginnote{\textcolor{blue}{2. }I dislike this right--justification, I prefer the center--justification.}

\end{document}

输出如下:

边注

我希望这个 \textit{marginnote} 从 \textit{Lorem ipsum} 的同一行开始... 并且我希望数字 \textcolor{blue}{1.} 出现在脚注的同一位置,但颜色为蓝色。此外,我不喜欢这种右对齐,我更喜欢居中对齐。

提前感谢您,希望我的问题清楚。

第一次编辑:我想要类似这张照片的东西

边注 霍比特人

pdflatex 中可以有这个模板吗?再次提前感谢。

答案1

我不确定您希望链接朝哪个方向,所以我将它们都设为双向链接。请注意,您无法对 hyperref 链接颜色进行太多更改,除非您关闭 colorlinks 并自行为其着色。

\documentclass[openany]{book}
\usepackage{xcolor}
\usepackage{marginnote}
\usepackage{lipsum}
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}

\renewcommand*{\raggedleftmarginnote}{\centering}
\renewcommand*{\raggedrightmarginnote}{\centering}

\newcommand{\mynote}[1]{\refstepcounter{footnote}\marginnote{\raisebox{\baselineskip}[0pt]{%
  \hypertarget{mynote.\thefootnote}{}}\hyperlink{mymark.\thefootnote}{\thefootnote} {#1}}}
\newcommand{\mymark}{\raisebox{\baselineskip}[0pt]{\hypertarget{mymark.\thefootnote}{}}%
  \hyperlink{mynote.\thefootnote}{\footnotemark[\thefootnote]}}

\title{Margin Notes}
\author{PUCK}
\date{May 2023}

\begin{document}

\maketitle

\section{Introduction}

\mynote{I'd like that this \textit{marginnote} starts at the same line of \textit{Lorem ipsum} ... and I'd like that a number \textcolor{blue}{1.} appears in same position of the footnote but with color blue.}
\lipsum[1-1]\mymark

\mynote{I dislike this right--justification, I prefer the center--justification.}
\lipsum[2-2]\mymark

\end{document}

相关内容