我正在处理可能很长的诗歌,这些诗歌可能有(子)节标题。以下是一个著名的例子。
问题是:我似乎无法控制 verse 环境中节标题的缩进。如果我完全删除 verse 环境,那么标题就会按照我想要的方式向左对齐,但是可以在 verse 中做到这一点吗?在 verse 环境中,标题是缩进的。在我理想的情况下,所有内容都会向左对齐。
这是一个简单的例子:
\documentclass[12pt]{scrartcl}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\parskip}{12pt}
\begin{document}
\begin{verse}
Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\adipisicing
elit, sed do eiusmod\\tempor incididunt ut labore et\\dolore magna
aliqua. Ut enim
ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.
\section{Example Section}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\subsection{Example subsection}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\subsubsection{Example subsubsection}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\end{verse}
\end{document}
答案1
可能最简单的方法是:
\documentclass[12pt]{scrartcl}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\parskip}{12pt}
\let\oldsection\section
\renewcommand\section[1]{%
\end{verse}\oldsection{#1}\begin{verse}}
\let\oldsubsection\subsection
\renewcommand\subsection[1]{%
\end{verse}\oldsubsection{#1}\begin{verse}}
\let\oldsubsubsection\subsubsection
\renewcommand\subsubsection[1]{%
\end{verse}\oldsubsubsection{#1}\begin{verse}}
\begin{document}
\begin{verse}
Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\adipisicing
elit, sed do eiusmod\\tempor incididunt ut labore et\\dolore magna
aliqua. Ut enim
ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.
\section{Example Section}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\subsection{Example subsection}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\subsubsection{Example subsubsection}
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
Fusce vulputatecongue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.
\end{verse}
\end{document}
如果你需要一个部分不是正在verse
使用\oldsection