如何使题词文本和来源同时居中并加宽?

如何使题词文本和来源同时居中并加宽?

我想将题词居中并加宽,包括其来源。所以我做了类似的事情:

\documentclass {scrbook}

\usepackage {epigraph}

\setlength \epigraphwidth {\textwidth}
\setlength \epigraphrule {0pt}
\renewcommand {\epigraphflush} {center}
\renewcommand {\sourceflush} {center}

\begin {document}
\chapter {Chapter}
\epigraph {A somewhat long epigraph should be here.}  {— Name}

This paragraph text should fill at least a whole line to give a better
idea of what I am doing here.

\end {document}

但尽管我让源居中,文本却左对齐。这是怎么回事?

答案1

实际上\renewcommand {\epigraphflush} {center}将包含题词的小页面居中,但在此小页面内,题词保持对齐。因此,如果题词宽度是文本宽度,您将看不到任何内容,除非您添加\centering command

\documentclass {book}

\usepackage {epigraph}

\setlength \epigraphwidth {\linewidth}
\setlength \epigraphrule {0pt}
\AtBeginDocument{\renewcommand {\epigraphflush}{center}}
\renewcommand {\sourceflush} {center}

\begin {document}

\chapter {Chapter}
\epigraph {\centering A somewhat long epigraph should be here.} {— Name}

This paragraph text should fill at least a whole line to give a better
idea of what I am doing here.

\end {document} 

在此处输入图片描述

相关内容