latex中的引号问题
(2018-06-08 08:02:03)分类: tex/latex |
latex 中的引号问题
参考:
*
https://tex.stackexchange.com/questions/10670/quotes-in-latex
* http://www.yeslib.com/detail/3588
不做深入讨论,因为在xelatex下使用utf8,可以直接输入引号。如果要考虑一些特殊情况,可以参考如下的内容:
## Can I just use " for the quotes in my document?
Q:I'm asking this because when I use them in my TextMate
editor the included text is highlighted with a red color.
Therefore, I was wondering if I should instead some other symbol
preceded by \.
A: Harald Hanche-Olsen:
Yes, you can, but you shouldn't. Instead, use ``quoted'' to
get the result “quoted”, assuming you are writing English. Some
languages prefer quotes like «this» or like »that«, and those you
can enter directly, provided you have the right input encoding set
up. (You can input “ and ” directly too, if you use a utf-8 input
encoding.)
Note that in some languages, babel uses the " character for
various purposes not related to quotation marks, so it really is
best to avoid it.
A: Martin Scharrer
In general it is better to use either `` and '' to start and
end quoting or packages like csquotes and babel. The latter gives
you a great support for many languages and their quotes.
However, if you, and the packages you use, don't use the "
mark for anything else, you could just define it to automatically
insert the above start and end quote marks:
\documentclass{article}
\newif\ifquoteopen
\catcode`\"=\active % lets you define `"` as a macro
\DeclareRobustCommand*{"}{%
}
% Deactive with: \catcode`\"=12\relax % changes `"` back to
normal
\begin{document}
\section{About "quotes"}
A "quote" is a "quote" is a "quote".
\end{document}
The quotes will automatically open and close. The quote status
can be manually set using \quoteopenfalse and \quoteopentrue. This
behavior is local to the TeX group, e.g. local to an environment.
If this is not wanted a \global can be added before this
macros.
This seems to work fine in section titles and also works with
babel. However babel sets the language at \begin{document} which
might overwrite " again. In this case the macro should be
(re-)declared afterwards.
It shall be noted that this might break code which writes the
" in an non-text context to the .aux or other auxiliary file.
A: Leo Liu:
You can just use " as right quotation mark in some font
encodings, but it is upright quotation mark in some other font
encodings, sometimes it isn't quotation mark.
In OT1,OT2 encoding, " is right quotatoin mark (for CM fonts).
In T1 encoding, it is upright quotation mark. And in EU1(for
XeLaTeX) and EU2(for LuaLaTeX), " is right quotation mark the same
as ”.
IMHO, it is better to use double ' as quotation mark, or to
use csquotes package. If you use XeLaTeX or LuaLaTeX, use “ ” is
better.
The symbol " should be left for other usage, for example,
accents in some languages (using babel).
" can be used to replace '', but it cannot replace ````
## LaTeX:修正向后引号
在LaTeX,如果你以正常的方式写报价(标点符号),那么你会遇到问题。通常我们用引号将词语写成:“你的话”。这在LaTeX中显示为“您的单词”(开始和结束报价面向同一侧)。
在LaTeX中正确的书写方式是:
`Your word' = for single
quote
``Your words'' = for double quotes
您还可以使用csquotes包来实现此目的。
\enquote{Your words} = for single
quote
\enquote*{Your words} = for double
quotes
引号是上下文敏感的。如果您使用“english”(美国)作为babel包的选项,则单引号和双引号将切换。
这里使用'英国'选项为babel包。
这里是使用csquotes包的示例文档代码。
\documentclass{article}
\usepackage[british]{babel}
\usepackage{csquotes}
\begin{document}
This will not work: "General quotation mark"
(generates backward quotation mark at the beginning) \\
This will work: \enquote{Hello Single World} and
\enquote*{Testing Double}
\end{document}
前一篇:tex中的字体问题回顾