summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/logical-markup-utils/quoted.sty
blob: 0d7f8f0226fdf46be0d215a5e4b7b00d4cba16ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
% Copyright (C) 2009 Michał Masłowski

% This file is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This file is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% As a special exception, when this file is read by TeX when
% processing a TeX source document, you may use the result without
% restriction.


\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{quoted}[2009/04/17 language-dependent inline quotes]

% Declare a language for quotes.  The arguments are the name of the
% language and all quote commands: outer left, outer right, inner left
% and inner right.
\newcommand{\quoted@declarelanguage}[5]{%
  \DeclareOption{#1}{%
    \let\quoted@outerleft=#2%
    \let\quoted@outerright=#3%
    \let\quoted@innerleft=#4%
    \let\quoted@innerright=#5}}

\quoted@declarelanguage{american}
  \textquotedblleft\textquotedblright
  \textquoteleft\textquoteright

\quoted@declarelanguage{british}
  \textquoteleft\textquoteright
  \textquotedblleft\textquotedblright

\quoted@declarelanguage{german}
  \quotedblbase\textquotedblleft
  \guillemotright\guillemotleft

\quoted@declarelanguage{polish}
  \quotedblbase\textquotedblright
  \guillemotleft\guillemotright

\ExecuteOptions{american}\relax % The default.
\ProcessOptions\relax

\newif\ifquoted@inquote\quoted@inquotefalse

% In English literature multi-paragraph dialogue has unmatched quotes
% -- left one is used on the beginning of each paragraph and right one
% only at the end of the entire speech.  Therefore, separate commands
% for left and right quotes are necessary.
\DeclareRobustCommand{\lquote}{%
  \ifquoted@inquote
    \quoted@innerleft
  \else
    \quoted@outerleft
  \fi}
\DeclareRobustCommand{\rquote}{%
  \ifquoted@inquote
    \quoted@innerright
  \else
    \quoted@outerright
  \fi}
  
% Since quotes inside quotes have different style, it is changed by
% the following command.
\DeclareRobustCommand{\inquote}{%
  \ifquoted@inquote
    \quoted@inquotefalse
  \else
    \quoted@inquotetrue
  \fi}

% On the above commands a command which quotes its argument is
% based.
\DeclareRobustCommand*{\quoted}[1]{%
  \lquote{\inquote#1}\rquote}