pdflatex:如何区分撇号和单右引号?

pdflatex:如何区分撇号和单右引号?

继续评论“如果使用区分单引号和撇号的文字处理器/排字机...”https://english.stackexchange.com/questions/286321/distinguishing-apostrophes-from-quotation-marks,LaTeX 有这个功能吗?在这个问题中,我主要对pdflatex基于 的旧解决方案感兴趣(然后才对 感兴趣xelatex)。

原因:有时我必须排版如下的短语

最初于 1965 年由 Harper & Row 出版,属于“哈珀现代数学系列”系列。

在英式英语中,单引号占主导地位。当然,您可以使用另一种格式来规避这种特殊情况,例如,使用与英式英语惯例相反的双引号或使用斜体:

最初于 1965 年由 Harper & Row 出版,属于该系列哈珀的现代数学系列

但我想知道 LaTeX(或任何软件包)是否为我们提供了一种通过区分英式英语中的撇号和右单引号来真正解决这个问题的方法。

换句话说,我正在寻找一种更优雅的方法来编写以下内容:

\documentclass{book}
\usepackage[T2A,T1]{fontenc}%%% The fontenc package is explicitly loaded with the T2A,T1 argument simply to avoid the warning of babel about missing T2A in the log. As for the order of loading, David Carlisle says in https://tex.stackexchange.com/questions/241452/generating-a-template/241479#241479 that fontenc produces information needed by inputenc (which, however, delays processing till the beginning of the document, which makes the order of these two packages irrelevant). Moreover, in the examples in the documentation of newtx fontenc is always loaded before newtx.
\usepackage[utf8]{inputenc} % Native LaTeX umlaut support
\usepackage[USenglish,british,canadian,finnish,latin,russian,french,dutch,german,ngerman]{babel} % warning: last language option will be chosen for fixed text of environments like example or definition (in svmono)
\usepackage{newtxtext}% Load it after babel according to Michael Sharpe's newtx manual from Dec 14, 2017.
\usepackage[slantedGreek]{newtxmath}%% Should be loaded after the text font according to its manual. The default uppercase Greek letters should be slanted according to the SVMono manual.
\usepackage{courier}
\usepackage[babel=true,final=true,verbose=errors,protrusion=true,expansion=true]{microtype}%%% Not strictly needed, but improves on hyphenation. Moreover, some folks say it produces a visually more pleasant text. The options "spacing" is said to be still experimental, and the option "kerning" doesn't make sense unconditionally; that's why we don't use them.
\usepackage{babelbib}
\usepackage{mathtools}%%% loads amsmath internally
\mathtoolsset{mathic=true} %%% See https://tex.stackexchange.com/a/3496/
\multlinegap=0pt
\usepackage{amssymb}
\usepackage{stmaryrd}
\usepackage{csquotes}
\usepackage[pdftitle={Some clever title},hidelinks,pdfauthor={Myself, the beloved one}]{hyperref}\usepackage{filecontents}
\usepackage[ngerman,capitalize]{cleveref}
\begin{filecontents}{\jobname.bib}
@book{Cohn-UniversalAlgebra1981,
  title={Universal algebra},
  author={Paul Moritz Cohn},
  series={Mathematics and its applications/6},
  edition={Revised},
  OPTurl={http://books.google.de/books?id=T4QZAQAAIAAJ},
  note={Originally published in 1965 by Harper \& Row in the series \textquoteleft Harper\textquotesingle s series in modern mathematics\textquoteright},
  year={1981},
  publisher={D.~Reidel Publishing Company},
  isbn={978-90-277-1254-7},
  language={british}
}
@article{CousotCousot-ConstructiveVersionsOfTarskisFixedPointTheorems,
    Author = {Patrick Cousot and Radhia Cousot},
    Journal = {Pacific Journal of Mathematics},
    Language = {USenglish},
    Number = 1,
    Pages = {43--57},
    Title = {Constructive Versions of {T}arski's Fixed Point Theorems},
    Volume = 81,
    Year = 1979
}
\end{filecontents}
\begin{document}
Sag mal', stimmt's, dass "`Die Mathematik ist die Königin der Wissenschaften"' von Gauß stammt?
Hier ein paar Texte dazu: \cite{Cohn-UniversalAlgebra1981,CousotCousot-ConstructiveVersionsOfTarskisFixedPointTheorems}, und hier eine Formel: \(x'=x^{\backprime}+1\).
\bibliographystyle{babalpha-fl-gs-sort}%%% Avoid problematic abbreviations such as SS and SA, see https://tex.stackexchange.com/a/441877/165772. Also disabmiguate certain repetitions; see https://tex.stackexchange.com/a/472956/165772.
\bibliography{\jobname}
%%% For whatever reason, though the language of the Cohn entry is british, put an \enquote there produces German quotation marks...
\end{document}

答案1

您说您不明白为什么不应该使用U+0027撇号和U+2019右单引号。

您可以使用该csquotes包并对其进行简写'并将其定义为直引号来做到这一点。babelbritish笔记当当前语言是时,这将在任何地方使用直撇号british,而不仅仅是在引号内。

此代码适用于所有 TeX 引擎(包括fontspec)。

但我认为这是个坏主意,你应该坚持U+2019下去。

\documentclass{article}

\usepackage[british,ngerman]{babel}

\addto\extrasbritish{%
  \languageshorthands{british}%
}
\useshorthands{'}
\defineshorthand[british]{'}{%
  \textormath{\textquotesingle}{^{\prime}}}
\defineshorthand[ngerman]{'}{%
  \textormath{\textquoteright}{^{\prime}}}

\usepackage[autostyle=true]{csquotes}

\usepackage{textcomp}

\begin{document}

\selectlanguage{british}

\section*{british}

\enquote{Harper's series in modern mathematics}

If you need to produce \verb|U+2019| by itself, either type it directly (’) or
use \verb|\textquoteright| (\textquoteright).

This works too ‘Harper's series in modern mathematics’ if you don't want to
use \verb|csquotes|.

Prime should still work in mathmode: $'$

\selectlanguage{ngerman}

\section*{ngerman}

\enquote{Harper's series in modern mathematics}

If you need to produce \verb|U+2019| by itself, either type it directly (’) or
use \verb|\textquoteright| (\textquoteright).

This works too „Harper's series in modern mathematics“ if you don't want to
use \verb|csquotes|.

Prime should still work in mathmode: $'$

\end{document}

输出

相关内容