对话的缩进应该与常规段落缩进不同

对话的缩进应该与常规段落缩进不同

我发现一本旧书有一个非常有趣的功能:当段落以引号开头时,缩进会有所不同。我想知道如何在 LaTeX 中实现这一点。

This is just a sentence to simulate the last line of a paragraph.
   This is a short new paragraph with regular indentation.
  "This has a reduced indentation (width of a quotation mark). How to do that?"
   And here the next paragraph starts with regular indentation again. I put some more words into it. This is another sentence to lengthen the paragraph. This is another sentence to lengthen the paragraph.

我认为微类型包的突出功能在这里没有帮助:它会挤压内联对话框中边缘的引号。

是否有我不知道的包或命令可以实现此目的?抱歉,没有 MWE,但我甚至不知道从哪里开始。

答案1

当然,你随时可以手动向后移动(或者,根据情况,抑制段落开头的缩进,并且比平时移动得更少):

\documentclass{article}
\usepackage{calc}

%\setlength{\parindent}{2em}
\newcommand\hangquote{\noindent\hspace{\parindent-\widthof{“}}“}

\begin{document}

\noindent Sed ut perspiciatis unde omnis iste natus error sit voluptatem 
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo 
inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo 
enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia 
consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. 

   This is a short new paragraph with regular indentation.

   \hangquote This has a reduced indentation (width of a quotation mark). How to do that?”
 
 And here the next paragraph starts with regular indentation again. I put some 
more words into it. This is another sentence to lengthen the paragraph. This is 
another sentence to lengthen the paragraph.

\end{document}

在此处输入图片描述

可能有比这更好的解决方案,但它快速又简单:-)

预计到达时间:修改为自动计算所需偏移量(使用calc

答案2

虽然我最终成功了,但在尝试制定答案时我遇到了一些问题。我的尝试和结果如下所示。

% paraprob.tex  SE 587406
\documentclass{article}
\usepackage{hanging}
\newcommand{\quoted}[1]{\begin{hangpunct}``#1\end{hangpunct}}
\newcommand{\lllap}[1]{\makebox[0pt][r]{#1}}

\begin{document}
\noindent some text at the end of a paragraph.

Regular indented paragraph.

\llap{``}Quoted (llap) indented paragraph.

\lllap{``}Quoted (lllap) indented paragraph.

\begin{hangpunct}
``Quoted (hangpunct) indented paragraph.
\end{hangpunct}

\quoted{Quoted} (quoted) indented paragraph.

Regular indented paragraph. \llap{``}Quote

Regular indented paragraph. Quote

\end{document}

在此处输入图片描述

我以为 Knuth 的\llap宏(将其参数排版到左侧)可以解决问题,但它没有开始一个段落。该\hanging包帮助其hangpunct环境(在这种情况下将标点符号挂在左侧)很有用,但使用起来很笨拙。我最终想出了\lllap(latex 版本的\llap)宏,它似乎符合要求。这是基于https://stackexchange.com/questions/146098谢谢。

相关内容