[Tex/LaTex] csquotes: punctuation and quotation marks

csquotespunctuation

csquotes automatically includes or excludes the punctuation marks in or from the quotation depending on the language specified in the preamble. This can be adjusted individually by commands like \DeclareAutoPunct{.,;!?} etc.

british example: "This is a quote".

american example: "This is a quote."

I now designed a newcommand that wrapps a quotation into different quotation symbols. Let just for the sake of the question this example be the case:

custom example: °This is a quote°.

I did this simply be by the following newcommand: \newcommand{\strangequote}[1]{°#1°}

This of course does not move punctuation inside or outside the quotation marks. Could I change the command so that it does? How can I design a command that

  1. also pays attention to the definitions of \DeclareAutoPunct{.,;!?} (so that I globally chooses for all my quotations whether to include or exclude the punctuation) or

  2. allows me to choose for strangequote individually whether or not to include the punctuation.

Can csquotes' command \MakeForeignQuote be of any help?

Clarification: I do want to use this command in addition to the normal command (enquote or textquote) that sets british or american quotation marks.

(Small question aside: I never got the difference between quote commands and the quote commands with a "c", e.g., between \textquote and \textcquote)

Best Answer

I've never really made csquotes do my bidding with trailing punctuation, so I hope someone else answers. However, with \@ifnextchar, you can do a poor man's implementation. Where it probably fails is in respecting \spacefactor, but maybe someone else can also point out where my hacks can be improved. Anyway...

\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}
Related Question