单独缩进以 \\ 分隔的换行行

单独缩进以 \\ 分隔的换行行

我有这样的长行:

Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist, \\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word, \\
Saint Raphael, who didst lead Tobias safely through his journey to his home again, \\

渲染结果如下:


圣加百列向扎卡里预言了施洗者约翰 的诞生和事奉,
圣加百列向圣母玛利亚宣告了
圣言的化身,
圣拉斐尔引导托比亚斯安全地回到了
家,

但我想要:


     圣加百列向扎卡里预言了施洗者约翰 的诞生和事奉,
圣加百列向圣母玛利亚宣告了
     圣言的化身,
圣拉斐尔引导托比亚斯安全地回到了
     家,

我如何缩进包装的内容?

有没有办法用 a 来做\renewcommand{\\}{…}

答案1

我猜你想让这样的文本与上下文通过一些垂直空间和更宽的边距分开。

在此实现中,标准宽度为列宽的 75%,但您可以使用可选参数指定其他宽度。我使用此功能来显示当宽度与列宽相同时,行将完全适合文本框。

我建议\\使用空行,但这取决于您的选择。

\documentclass{article}

\usepackage{lipsum} % for context

\newenvironment{hymn}[1][0.75\columnwidth]
 {%
  \par\addvspace{\topsep}%
  \setlength{\parindent}{-\hymnindent}%
  \setlength{\leftskip}{\dimeval{(\columnwidth-#1)/2+\hymnindent}}%
  \setlength{\rightskip}{\dimeval{\leftskip-\hymnindent}}%
  \let\\=\par
 }
 {\par\addvspace{\topsep}}

\newlength{\hymnindent}
\AtBeginDocument{%
  \setlength{\hymnindent}{\parindent}% or whatever you prefer
}

\begin{document}

\lipsum[1][1-4]

\begin{hymn}
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,\\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,\\
Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[2][1-4]

\begin{hymn}[\columnwidth]
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,

Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,

Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[3][1-4]

\end{document}

在此处输入图片描述

您可能希望将标题放在左侧。

\documentclass{article}

\usepackage{lipsum} % for context

\newenvironment{hymn}[1][0.75\columnwidth]
 {%
  \par\addvspace{\topsep}%
  \setlength{\parindent}{-\hymnindent}%
  \setlength{\leftskip}{\hymnindent}
  \setlength{\rightskip}{\dimeval{\columnwidth+\hymnindent-#1}}%
  \let\\=\par
 }
 {\par\addvspace{\topsep}}

\newlength{\hymnindent}
\AtBeginDocument{%
  \setlength{\hymnindent}{\parindent}% or whatever you prefer
}

\begin{document}

\lipsum[1][1-4]

\begin{hymn}
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,\\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,\\
Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[2][1-4]

\begin{hymn}[\columnwidth]
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,

Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,

Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[3][1-4]

\end{document}

在此处输入图片描述

parskip

\documentclass{article}
\usepackage{parskip}

\usepackage{lipsum} % for context

\newenvironment{hymn}[1][0.75\columnwidth]
 {%
  \par
  \addvspace{\parskip}%
  \setlength{\parskip}{0pt}%
  \setlength{\parindent}{-\hymnindent}%
  \setlength{\leftskip}{\hymnindent}%
  \setlength{\rightskip}{\dimeval{\columnwidth+\hymnindent-#1}}%
  \let\\=\par
 }
 {\par}

\newlength{\hymnindent}
\AtBeginDocument{%
  \setlength{\hymnindent}{2em}% or whatever you prefer
}

\begin{document}

\lipsum[1][1-4]

\lipsum[1][1-4]

\begin{hymn}
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,\\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,\\
Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[2][1-4]

\lipsum[2][1-4]

\begin{hymn}[\columnwidth]
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,

Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,

Saint Raphael, who didst lead Tobias safely through his journey to his home again, and did something else which I write here just to show what happens with a long line
\end{hymn}

\lipsum[3][1-4]

\end{document}

在此处输入图片描述

答案2

只是想知道为什么你没有发布最少的代码?

这是考虑到默认行为的一种方法;如您所见,除非我们至少知道您的页面几何形状等,否则几乎无需做更多的事情:

结果

\documentclass[12pt,letter]{article}

\begin{document}
\section{As posted}
Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist, \\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word, \\
Saint Raphael, who didst lead Tobias safely through his journey to his home again, \\

\section{Some trials}
Saint Gabriel, who didst foretell to Zachary the birth and ministry of

John the Baptist, \\
Saint Gabriel, who didst announce to Blessed Mary the Incarnation

of the Divine Word, \\
Saint Raphael, who didst lead Tobias safely through his journey to

his home again, \\

\end{document}

答案3

虽然它的预期用途并不明确,但这个scripture包也许会适合你。有很多选项可以调整缩进和间距。

\documentclass{article}
\usepackage{lipsum}
\usepackage{scripture}
\scripturesetup{
  poetry/indent=0pt,
  poetry/bigindent=2em,
}
\begin{document}
\lipsum[1]

\begin{quote}
  \begin{scripture}
    \begin{poetry}
      Saint Gabriel, who didst foretell to Zachary the birth and ministry of John the Baptist,
      Saint Gabriel, who didst announce to Blessed Mary the Incarnation of the Divine Word,
      Saint Raphael, who didst lead Tobias safely through his journey to his home again,
    \end{poetry}
  \end{scripture}
\end{quote}

\lipsum[2]
\end{document}

输出

相关内容