答案1
图像上的文档片段对我来说看起来像是单列文档的片段,其中命令\marginpar
用于将注释放入页边距,文本颜色为蓝色,\raggedleft
左侧页面(页码为偶数)为文本,右侧\raggedright
页面(页码为奇数)可能为文本。(请注意,使用\raggedleft
/\raggedright
时,需要确保\par
在这些“开关”生效时执行该操作。)
可能是这样的——\ifthispageodd
包中的命令scrextend
用于检测放置边距段落的页面的页码的奇偶校验;为了应对(La)TeX 输出例程的异步性,由于这种异步性,评估页面计数器的当前值不可靠,依次在\ifthispageodd
内部放置和评估引用标签,这意味着您需要至少编译文档两次,直到所有内容匹配:
\documentclass[twoside]{report}
\usepackage{scrextend}
\usepackage{color}
{\normalfont\normalsize
\expandafter}\expandafter\parskip\expandafter=\the\ht\strutbox
\parindent=0em
\begin{document}
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\newpage
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\newpage
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
This is blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
This is main text. This is main text. This is main text. This is main text.
\leavevmode\marginpar{%
\begingroup
\leavevmode
\ifthispageodd{\raggedright}{\raggedleft}%
\itshape
\color{blue}%
Blue text.%
\par
\endgroup
}%
This is main text. This is main text. This is main text. This is main text.
\end{document}