我创建了一个新命令来格式化我的祈祷书中的标题。我希望新命令居中,但使用以下代码,新命令的上方和下方有额外的空间。我尝试使用\centering
而不是\begin{center}
\end{center}
。但它无法编译居中。
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{xcolor}
\newcommand{\prayerheading}[1]{%
\begin{center}
\noindent\large\bfseries\textcolor{red}{#1}\normalsize
\end{center}
}
\newcommand{\psalmheading}[1]{%
{\centering
\noindent\large\bfseries\textcolor{red}{#1}\normalsize
}
}
\title{Test}
\author{Michael}
\begin{document}
\maketitle
\prayerheading{Introductory Prayer}
In the name of the Father, and of the Son, and of the Holy Spirit. Amen.\\
Glory to Thee, our God, glory to Thee.\\
\prayerheading{Evening Troparia}
Have mercy on us, O Lord have mercy on us, for laying
aside all excuse, we sinners offer to Thee as to our
Master this supplication: have mercy on us.\\
\psalmheading{Evening Troparia}
Have mercy on us, O Lord have mercy on us, for laying
aside all excuse, we sinners offer to Thee as to our
Master this supplication: have mercy on us.\\
\end{document}
很抱歉,我一直无法正确编辑代码中的所有文本。因此,我尝试保留原始代码的外观:\prayerheading
但上面和下面没有多余的空格。
谢谢
答案1
(根据 OP 的要求,在定义中添加了指令\medskip
)\smallskip
\psalmheading
因此,我尝试保留原始代码 [for
\psalmheading
] 的外观:\prayerheading
但没有上下多余的间距。
像这样吗?
\documentclass[12pt]{article}
\usepackage[document]{ragged2e}
\usepackage{xcolor}
\newcommand{\prayerheading}[1]{%
\begin{center}
\large\bfseries\color{red}#1
\end{center}
}
\newcommand{\psalmheading}[1]{%
\begingroup
\par\medskip% <-- new: \medskip
\centering\large\bfseries\color{red}#1
\par\smallskip% <-- new: \smallskip
\endgroup}
\begin{document}
\prayerheading{Introductory Prayer}
In the name of the Father, and of the Son, and of the Holy Spirit. Amen.
Glory to Thee, our God, glory to Thee.
\prayerheading{Evening Troparia}
Have mercy on us, O Lord have mercy on us, for laying aside all excuse, we sinners offer to Thee as to our Master this supplication: have mercy on us.
\psalmheading{Evening Troparia}
Have mercy on us, O Lord have mercy on us, for laying aside all excuse, we sinners offer to Thee as to our Master this supplication: have mercy on us.
\end{document}