我正在使用apa7
软件包撰写手稿(\documentclass[man]{apa7}
)。我试图在某些段落(某些行)旁边添加边注/注释,总结其要点,以说明我为什么写这些段落以及为什么我选择将其放在手稿中的那个位置。在 TeX.SE 上搜索类似问题(例如前 50 个搜索结果) 并没有给我提供解决方案。
(我知道apa7
手稿文档类型有局限性,而且并不意味着看起来太好/令人愉悦,但是在我们写作的这个阶段,我需要使用 APA 手稿格式才能排版出版。)
期望结果
理想情况下,我希望这样的边距注释出现在文本的左侧,并垂直方向:
此外,在段落旁边加一条垂直线也会很有帮助:
如果可以通过宏(?)来实现,那就太好了,可以在整个文档的序言中打开/关闭它(就像这样彩色评论的解决方案),例如,当我们想要一个干净的 PDF,而又不想手动删除所有注释时。
目前的解决方案和缺点
就我对 TeX 的了解程度而言,我尝试使用\marginpar{...}
and \todo[noline]{...}
(来自todonotes
包)来尝试在页边距上书写,但效果并不理想。但是,我无法更改文本的方向。此外,文本换行非常糟糕,我无法将它们放在左边距上。以下是我得到的结果:
下面是一个(不太简短的) MWE 来重现它:
\documentclass[man]{apa7}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}
\usepackage{todonotes}
\title{Sample APA-Style Document Using the \textsf{apa7} Package with marginpar/todonotes}
\author{ManuHaq}
\affiliation{A University Somewhere}
\leftheader{ManuHaq}
\abstract{This is an MWE for TeX.SE, that asks for margin notes in an APA7 manuscript.}
\keywords{APA style, demonstration, marginpar, todonotes}
\begin{document}
\maketitle
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of,as far as I know, the things in themselves; as I have shown elsewhere, the phenomenashould only be used as a canon for our understanding.
\marginpar[left]{A margin note that, unfortunately, doesn't wrap well :(}
The paralogisms of practical reasonare what first give rise to the architectonic of practical reason.
As will easily be shown inthe next section, reason would thereby be made to contradict, in view of theseconsiderations, the Ideal of practical reason, yet the manifold depends on the phenomena
Let us suppose that the noumena have nothing to do with necessity, sinceknowledge of the Categories is a posteriori.
Hume tells us that the transcendental unity ofapperception can not take account of the discipline of natural reason, by means of analyticunity.
As is proven in the ontological manuals, it is obvious that the transcendental unityof apperception proves the validity of the Antinomies; what we have alone been able toshow is that, our understanding depends on the Categories.
It remains a mystery why theIdeal stands in need of reason. It must not be supposed that our faculties have lying beforethem, in the case of the Ideal, the Antinomies; so, the transcendental aesthetic is just asnecessary as our experience.
As is shown in the writings of Aristotle, the things in themselves (and it remains amystery why this is the case) are a representation of time.
\todo[noline]{A todonote with no line. As you see, the text again doesn't wrap well :(}
Our concepts have lying before them the paralogisms of natural reason, but our a posteriori concepts have lying before them the practical employment of our experience.
Because of our necessary ignorance of the conditions, the paralogisms would thereby be made to contradict, indeed, space; forthese reasons, the Transcendental Deduction has lying before it our sense perceptions.
(Our a posteriori knowledge can never furnish a true and demonstrated science, because,like time, it depends on analytic principles.)
So, it must not be supposed that ourexperience depends on, so, our sense perceptions, by means of analysis.
\end{document}
最后一个愿望
如果垂直边距注释超出段落长度,则可以自动换行,或者只允许在其中添加手动换行符,这样就太好了。
答案1
这假设注释出现在段落的哪个位置并不重要,因为它会扩展以填充空间。
奇数页检查并不完全可靠(如果整个段落被移到下一页)。请参阅 ifoddpage 包。
\documentclass{book}
\usepackage{marginfix}% not needed, just usefuld
\usepackage{varwidth}% for short notes
\usepackage{adjustbox}% for rotatebox
\usepackage{lipsum}% MWE only
\newif\ifshownoted
\shownotedtrue% default \shownotedfalse
\newsavebox{\notedbox}
\makeatletter
\def\udbox#1{% fragile, see lrbox
\edef\reserved@a{%
\endgroup
\setbox#1\vbox{%
\begingroup\aftergroup}%
\def\noexpand\@currenvir{\@currenvir}%
\def\noexpand\@currenvline{\on@line}}%
\reserved@a
\@endpefalse
\color@setgroup
\ignorespaces}
\def\endudbox{\unskip\color@endgroup}
\makeatother
\newenvironment{noted}[1]{% #1 = note to be placed alongside paragraph
\par\strut\vspace{-\baselineskip}\hrule height0pt% fix spacing
\def\passparameter{#1}%
\begin{udbox}{\notedbox}\strut}% measure height
{\strut\end{udbox}%
\ifshownoted
\sbox0{\begin{varwidth}{\dimexpr \ht\notedbox+\dp\notedbox}% measure width
\passparameter
\end{varwidth}}%
\sbox2{\rlap{\usebox0}\raisebox{\dimexpr-\dp0-0.5\marginparsep}[0pt][0pt]{\rule{\wd0}{1pt}}}% add line below
\ifodd\value{page}%
\marginpar{\rotatebox{-90}{\usebox2}}%
\else
\marginpar{\hfill\rotatebox{90}{\usebox2}}%
\fi
\fi% ebd \ifshownoted
\unvbox\notedbox
}
\begin{document}
\lipsum[1]
\begin{noted}{This is a short note}
\lipsum[1]
\end{noted}
\begin{noted}{This is a longer note, Also a shorter paragraph.}
\lipsum[2]
\end{noted}
\newpage
\begin{noted}{This is a longer note, Also a shorter paragraph.}
\lipsum[2]
\end{noted}
\end{document}