
我用來pandoc
將 Markdown 文件轉換為 LaTeX 文檔,然後轉換為 PDF。我的文件包含一些引文。它們來自標準 Markdown,呈現為LaTeX 文件quotation
或quote
在 LaTeX 文件中呈現。
Markdown 不可能明確指出引文的簽名或來源。因此,我無法使用類似的套件attrib
來以不同的方式設定歸因部分的樣式。
問題:如何右對齊報價的簽名?更一般地說,如何右邊刷新區塊的最後一行?或者,以“--”開頭的行可以右對齊嗎? (這三個中任何一個都可以。)
這是一個最小的 LaTeX 文檔,它顯示了我的意圖。我希望將“-- Walt Disney”部分向右移動。
\documentclass{book}
\setlength{\parindent}{0em} % Added for clarity.
\renewcommand{\quote}{\list{}{\itshape}\item\relax} % Making quote italic.
\begin{document}
\begin{quote}
The way to get started is to quit talking and begin doing.
-- Walt Disney
\end{quote}
\end{document}
不,使用像dirtytalk
、csquotes
、 或 這樣的包epigraph
是行不通的。 Markdown 的來源不會(也不能)區分引用和歸屬。都是一個quote
街區。
答案1
在我看來,您似乎希望Markdown
獲得一種新的報價。你說“這不是 Markdown 文件包含樣式/渲染命令的想法”,但它確實如此——它支援規範斜體和大膽的字體。
關於 LaTeX,這裡有一個聲明 ( \justlastragged
),它將把段落的最後一行設為右對齊。
% lastraggedprob.tex SE 641048
\documentclass{article}
\newcommand{\paratext}{Just some text to fill up a couple of lines,
which might be used for a paragraph or
some other kind of text block. Let's hope it works out.}
\begin{document}
\newcommand{\justlastragged}{%
\leftskip =0pt plus 1fil
\rightskip =-\leftskip
\parfillskip=\leftskip
% \parindent = 0pt
}
\section{First}
Normal paragraph setting
\paratext
\paratext
\section{Second}
Last line of a paragraph being set flush right (ragged left).
\justlastragged
\paratext
\paratext
\paratext \paratext
\end{document}
該\justlastragged
聲明是我在 2007 年在 TUGboat 中描述的不同樣式段落的幾種設定之一https://tug.org/TUGboat/tb28-2/tb89glister.pdf
答案2
嘗試使用\hfill
來填滿先前的水平空間-- Walt Disney
。
\documentclass{book}
\setlength{\parindent}{0em} % Added for clarity.
\renewcommand{\quote}{\list{}{\itshape}\item\relax} % Making quote italic.
\begin{document}
\begin{quote}
The way to get started is to quit talking and begin doing.
\hfill -- Walt Disney
\end{quote}
\end{document}
是的,\hfill
只要 pandoc 輸出 LaTeX 或在後端使用 LaTeX 來產生 PDF,它就會被處理。
> The way to get started is to quit talking and begin doing.
>
> \hfill -- Walt Disney
(由 pandoc 產生的圖像;如果您希望它像 LaTeX 程式碼一樣為斜體,當然,您必須在 markdown 文件或 pandoc 的選項中添加更多內容,但我猜您已經知道如何做到這一點了?)