csquotes:标点符号和引号

csquotes:标点符号和引号

csquotes根据序言中指定的语言自动在引文中包含或排除标点符号。这可以通过类似\DeclareAutoPunct{.,;!?}etc 的命令单独调整。

英国示例:“这是一个引言”。

美国例子:“这是一个引言。”

我现在设计了一个newcommand将引文包装成不同引号符号的程序。为了回答这个问题,我们假设这个例子是这样的:

自定义示例:“这是一个引用”。

我这样做只是按照以下方式newcommand\newcommand{\strangequote}[1]{°#1°}

这当然不会移动引号内或外的标点符号。我可以更改命令使其移动吗?我如何设计一个命令

  1. 还关注\DeclareAutoPunct{.,;!?}(以便我全局选择全部我的引文是否包含或排除标点符号)或

  2. 允许我单独选择strangequote是否包含标点符号。

csquotes' 命令能\MakeForeignQuote有帮助吗?

澄清:我确实想使用这个命令此外到设置英国或美国引号的正常命令(enquote或)。textquote

(撇开小问题不谈:我从来没搞清楚过 quote 命令和带有“c”的 quote 命令之间的区别,例如,\textquote和之间\textcquote

答案1

我从来没有真正用csquotes尾随标点符号完成我的命令,所以我希望其他人能回答。但是,使用\@ifnextchar,你可以做一个穷人的实现。它可能失败的地方在于尊重\spacefactor,但也许其他人也可以指出我的黑客可以改进的地方。无论如何......

\documentclass[12pt, oneside]{article}
\usepackage[british,american]{babel}
\usepackage[autostyle=true,autopunct=true]{csquotes}
\parindent 0pt

%  default spacefactors (nonfrenchspacing):
%  1000 = normal space token
%  1250 = after comma    -\
%  1500 = after semicolon  > all 3 treated as if 1500
%  2000 = after colon    -/
%  3000 = after period, question mark, exclamation mark

\makeatletter

\def\preservesf#1#2{#1}% preserves spacefactor and gobbles punctuation ..?

\newcommand\sqa[1]{%
  ``#1%
  \@ifnextchar.{.''\preservesf{\spacefactor=3000\relax}}{%
    \@ifnextchar,{,''\preservesf{\spacefactor=1500\relax}}{''}}%
}

\newcommand\sqb[1]{% <--   strictly speaking, unnecessary.
  `#1%                     instead of defining this command, do
  \@ifnextchar.{'}{%       \sqb{<quoted text>}. as normal!!
    \@ifnextchar,{'}{'}}%  provided for illustrative purposes
}

\makeatother

\newif\ifamstyle %  basic switch so your \strangequote emulates
\amstyletrue     %  british or american style

\ifamstyle
  \let\strangequote\sqa
\else
  \let\strangequote\sqb
\fi


\begin{document}
% American emulation:
\selectlanguage{american}%
The language is: \languagename.

``''{This is a quote}. \the\spacefactor\ Really?

\sqa{This is a quote}. \the\spacefactor\ Really?

\sqa{This is a quote}, \the\spacefactor\ really!

\sqa{This is a quote}: \the\spacefactor\ really!

\sqa{This is a quote}; \the\spacefactor\ really!

\sqa{This is a quote}! \the\spacefactor\ really!

\sqa{This is a quote}? \the\spacefactor\ really!

% British emulation:
\selectlanguage{british}%
the language is: \languagename.

\enquote{This is a quote}. \the\spacefactor\ Really.

\sqb{This is a quote}. \the\spacefactor\ Really?

\sqb{This is a quote}, \the\spacefactor\ really!

\sqb{This is a quote}: \the\spacefactor\ really!

\sqb{This is a quote}; \the\spacefactor\ really!

\sqb{This is a quote}! \the\spacefactor\ really!

\sqb{This is a quote}? \the\spacefactor\ really!


\verb|\strangequote|:

\strangequote{This is a quote}. \the\spacefactor\ Really?

\strangequote{This is a quote}, \the\spacefactor\ really!

\strangequote{This is a quote}: \the\spacefactor\ really!

\strangequote{This is a quote}; \the\spacefactor\ really!

\strangequote{This is a quote}! \the\spacefactor\ really!

\strangequote{This is a quote}? \the\spacefactor\ really!

\end{document}

答案2

根据文档(PDF)8.1 和 9.1 节中,你可以使用以下方式添加自己的引用样式

\renewcommand{\mktextquote}[6]{#1#2#4#5#3#6}% or whatever your preference
\DeclareQuoteStyle{strangequotestyle}% style name
    {$^{\circ}$}% opening outer mark
    {$^{\circ}$}% closing outer mark
    {\textquoteleft}% opening inner mark
    {\textquoteright}% closing inner mark

在序言中并使用

\setquotestyle{strangequotestyle}
\textquote{Outer \textquote{inner}}.

在您的文档中。使用\setquotestyle{default}可再次切换回正常引用。

相关内容