我使用memoir
并定义了我自己的边注版本。我希望由多个段落组成的边注除了第一个段落外,每个段落都缩进。但是,我不知道如何防止第一个段落缩进。MWE 如下:
\documentclass[a4paper]{memoir}
\setstocksize{11.0in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*}
\setlength{\trimtop}{0.0in}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{9.0in}{4.87in}{*}
\setlrmargins{*}{1.0in}{*}
\setulmargins{1.0in}{*}{*}
\setmarginnotes{17pt}{1.5in}{\onelineskip}
\usepackage{lipsum}
%%% side notes
\marginparmargin{left}
\newcommand{\mysidenote}[1]{%
\strictpagecheck\marginpar{\setlength{\parindent}{1.0em}\footnotesize #1}%
}
\checkandfixthelayout
\begin{document}
\section{A Section}
\lipsum[1]
\mysidenote{
\lipsum[1]
\lipsum[2]
}%
\lipsum[2]
\end{document}
更新:David 的建议按预期工作,除非我使用\mysidenote
from within a \paragraph
。以下修改后的 MWE 显示了这一点:
\documentclass[a4paper]{memoir}
\setstocksize{11.0in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*}
\setlength{\trimtop}{0.0in}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{9.0in}{4.87in}{*}
\setlrmargins{*}{1.0in}{*}
\setulmargins{1.0in}{*}{*}
\setmarginnotes{17pt}{1.5in}{\onelineskip}
\usepackage{lipsum}
%%% side notes
\marginparmargin{left}
\makeatletter
\newcommand{\mysidenote}[1]{%
\strictpagecheck\marginpar{\setlength{\parindent}{1.0em}\footnotesize
\@afterheading #1}%
}
\makeatother
\checkandfixthelayout
\begin{document}
\section{A Section}
\lipsum[1]
\mysidenote{\lipsum[1]}
\paragraph{A Paragraph}
\lipsum[1]
\mysidenote{\lipsum[1]}
\end{document}
第一个\mysidenote
按预期工作(无缩进),但第二个不按预期工作(有缩进)。我想要的是改进的定义,使其\mysidenote
适用于所有部分环境,而无需在 中使用 \noindent \paragraph
。
答案1
最好不要使用\noindent
来抑制缩进,因为它会导致空白问题,尤其是开头的空行。您可以使用\@afterheading
latex 用来抑制标题后缩进的机制。
\documentclass[a4paper]{memoir}
\setstocksize{11.0in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*}
\setlength{\trimtop}{0.0in}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{9.0in}{4.87in}{*}
\setlrmargins{*}{1.0in}{*}
\setulmargins{1.0in}{*}{*}
\setmarginnotes{17pt}{1.5in}{\onelineskip}
\usepackage{lipsum}
%%% side notes
\marginparmargin{left}
\makeatletter
\newcommand{\mysidenote}[1]{%
\strictpagecheck\marginpar{\setlength{\parindent}{1.0em}\footnotesize
\@afterindentfalse\@afterheading #1}%
}
\makeatother
\checkandfixthelayout
\begin{document}
\section{A Section}
\lipsum[1]
\mysidenote{
\lipsum[1]
\lipsum[2]
}%
\lipsum[2]
\end{document}
答案2
我有两个答案,第一个与 John Kormylo 的答案相同,缩进除第一段之外的所有段落(请注意%
)\mysidenote{%
。
如果您希望缩进由单个段落组成的注释,则第二个答案不是修改宏\mysidenote
,而是在任何多段旁注中将其放在\noindent
任何多段注释的第一段之前。例如:
\mysidenote{%
\noindent\lipsum[1] % not indented
\lipsum[2] % indented
}
或者
\mysidenote{%
\lipsum[1] % indented
}
答案3
这是一个简单的修复,但我自己从来没有想到过它,直到我看到它被用在 sty 文件中。
\documentclass[a4paper]{memoir}
\setstocksize{11.0in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*}
\setlength{\trimtop}{0.0in}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{9.0in}{4.87in}{*}
\setlrmargins{*}{1.0in}{*}
\setulmargins{1.0in}{*}{*}
\setmarginnotes{17pt}{1.5in}{\onelineskip}
\usepackage{lipsum}
%%% side notes
\marginparmargin{left}
\newcommand{\mysidenote}[1]{%
\strictpagecheck\marginpar{\setlength{\parindent}{1.0em}\footnotesize
\noindent #1}%
}
\checkandfixthelayout
\begin{document}
\section{A Section}
\lipsum[1]
\mysidenote{% to prevent an extra space
\lipsum[1]
\lipsum[2]
}%
\lipsum[2]
\end{document}
答案4
\noindent
或者,如果您最初将其设置为零,并在处理完 的参数的第一个标记之后立即\parindent
将其增加到所需值( ) ,则可以避免使用:1em
\mysidenote
\newcommand{\mysidenote}[1]{%
\strictpagecheck\marginpar{\parindent0em\footnotesize\mysidenotei#1}}
\newcommand{\mysidenotei}[1]{#1\parindent1em}
完整代码
\documentclass[a4paper]{memoir}
\setstocksize{11.0in}{8.5in}
\settrimmedsize{11.0in}{8.5in}{*}
\setlength{\trimtop}{0.0in}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{9.0in}{4.87in}{*}
\setlrmargins{*}{1.0in}{*}
\setulmargins{1.0in}{*}{*}
\setmarginnotes{17pt}{1.5in}{\onelineskip}
\marginparmargin{left}
\newcommand{\mysidenote}[1]{\strictpagecheck\marginpar{\parindent0em\footnotesize\mysidenotei#1}}
\newcommand{\mysidenotei}[1]{#1\parindent1em}
\checkandfixthelayout
\begin{document}
\chapter{A chapter}
\section{A Section}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\mysidenote{%
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
}%
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
\end{document}