summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/csquotes/csquotes.tex
blob: 59eb6d05f50ae8f76e7f765c929faeb599e9eb5d (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
% $Id: csquotes.tex,v 4.4d 2010/02/06 18:19:34 lehman stable $
\documentclass{ltxdockit}[2009/05/24]
\usepackage[latin9]{inputenc}
\usepackage[american]{babel}
\usepackage[strict,babel=once]{csquotes}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{shortvrb}
\usepackage{pifont}
\MakeAutoQuote{«}{»}
\MakeAutoQuote*{<}{>}
\MakeShortVerb{\|}

\rcsid{$Id: csquotes.tex,v 4.4d 2010/02/06 18:19:34 lehman stable $}

\titlepage{%
  title={The \sty{csquotes} package},
  subtitle={Context sensitive quotation facilities},
  url={http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/},
  author={Philipp Lehman},
  email={plehman@gmx.net},
  revision={\rcsrevision},
  date={\rcstoday}}

\hypersetup{%
  pdftitle={The csquotes package},
  pdfsubject={Context sensitive quotation facilities},
  pdfauthor={Philipp Lehman},
  pdfkeywords={tex, e-tex, latex, quote, quotation,
  smart quotes, babel, multilingual typesetting}}

\AtBeginToc{\setcounter{tocdepth}{1}}
\AtEndToc{\setcounter{tocdepth}{5}}

% tables

\newcolumntype{H}{>{\sffamily\bfseries\spotcolor}l}
\newcolumntype{P}{>{\raggedright}p{120pt}}
\newcolumntype{Q}{>{\raggedright}p{70pt}}

\newcommand*{\vcmd}[1]{\rotatehead{1.5em}{9.5em}{\cmd{#1}}}
\newcommand*{\venv}[1]{\rotatehead{1.5em}{9.5em}{\env{#1}}}

\ifpdf
  \newcommand*{\rotatehead}[3]{%
    \makebox[#1][c]{\rotatebox{90}{\makebox[#2][l]{\scriptsize #3}}}}
\else
  \newcommand*{\rotatehead}[3]{%
    \makebox[#1][c]{\rule{0pt}{#2}}}
\fi

\newcommand{\tickmarkyes}{\Pisymbol{psy}{183}}
\newcommand{\tickmarkno}{\textendash}

% samples

\definecolor{grid}{rgb}{0.7,0.7,0.7}

\newcommand*{\mksample}[2][25]{%
  \mkmetrics[#1]{#2\,\textcolor{grid}{AaGg}\,#2}}

\newcommand*{\mkmetrics}[2][25]{%
  \setlength{\unitlength}{1pt}%
  \linethickness{0.25pt}%
  \begin{picture}(#1,0)(0,0)
   %\put(0,0){\parbox[b]{#1\unitlength}{\mkgrid{\fontdimen9\font}}}
    \put(0,0){\parbox[b]{#1\unitlength}{\mkgrid{\fontdimen5\font}}}
    \put(0,0){\parbox[b]{#1\unitlength}{\mkgrid{0pt}}}
   %\put(0,0){\parbox[b]{#1\unitlength}{\mkgrid{-\fontdimen11\font}}}
    \put(0,0){\parbox[b]{#1\unitlength}{\centering #2}}
  \end{picture}}

\newcommand*{\mkgrid}[1]{%
  \begingroup\color{grid}%
  \hrule height 0.25pt depth 0pt width \linewidth
  \hrule height #1     depth 0pt width 0pt
  \endgroup}

% hyphenation

\hyphenation{star-red}
\hyphenation{New-speak}
\hyphenation{thres-hold}
\hyphenation{re-pre-sent-ing}

\begin{document}

\printtitlepage
\tableofcontents
\listoftables

\section{Introduction}
\label{int}

This document is a systematic reference manual for the \sty{csquotes} package. It is supplemented by a hands-on tutorial including practical examples.%
\fnurl{http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/tutorial.tex}

\subsection{About}

This package provides advanced facilities for inline and display quotations. It is designed for a wide range of tasks ranging from the most simple applications to the more complex demands of formal quotations. The facilities include commands, environments, and user"=definable <smart quotes> which dynamically adjust to their context. Quotation marks are switched automatically if quotations are nested and can adjust to the current language. There are additional facilities designed to cope with the more specific demands of academic writing, especially in the humanities and the social sciences. All quote styles as well as the optional active quotes are freely configurable.

\subsection{License}

Copyright © 2003--2010 Philipp Lehman. Permission is granted to copy, distribute and\slash or modify this software under the terms of the \lppl, version 1.3c.\fnurl{http://www.ctan.org/tex-archive/macros/latex/contrib/csquotes/LICENSE}
%\fnurl{http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt}
This package is author"=maintained.

\subsection{Acknowledgments}

I am indebted to Donald Arseneau, Mark Wooding, and David Carlisle for valuable hints in the early stages of development. Frank Mittelbach kindly provided hooks in the \sty{inputenc} package. Additional thanks go to Robert Schlicht for his testing.

\subsection{Contributions}

The multilingual support of this package depends on user contributions. If you want to contribute a quote style, please refer to section \ref{cfg:sty} for an overview of the components a quote style is composed of and to table \ref{tab:out} for a list of commands which should be used in the definition of quote styles.

\subsection{Requirements}
\label{int:req}

This package requires \etex and the \sty{etoolbox} package which is readily available from \acr{CTAN}.\fnurl{http://www.ctan.org/tex-archive/macros/latex/contrib/etoolbox/} \tex distributions have been shipping \etex binaries for quite some time, most distributions even use them by default these days. The \sty{csquotes} package checks if it is running under \etex. Simply try compiling your documents as you usually do, the chances are that it just works. If you get an error message, try compiling the document with \path{elatex} instead of \path{latex} or \path{pdfelatex} instead of \path{pdflatex}, respectively.

\section{Package options}
\label{opt}

All package options are given in \keyval syntax.

\begin{optionlist}

\boolitem[false]{strict}

This option turns all package warnings into error messages. This is useful to ensure that no problem will go unnoticed when finalizing a document. The short form \opt{strict} is equivalent to \kvopt{strict}{true}.

\optitem[tryonce]{babel}{\opt{true}, \opt{false}, \opt{try}, \opt{once}, \opt{tryonce}}

This option controls multilingual support. \kvopt{babel}{true} continuously adapts the quote style to the language of the \sty{babel} package; \opt{once} will only adapt the style once so that it matches \sty{babel}'s main language. \kvopt{babel}{try} and \opt{tryonce} are similar to \opt{true} and \opt{once} if \sty{babel} is loaded but will not issue any warnings if it is not. The short form \opt{babel} is equivalent to \kvopt{babel}{true}. See also section \ref{bas:set}.

\intitem[2]{maxlevel}

This option controls the maximum nesting level of quotations. By default, this package supports two levels of quotations, outer and inner ones, and issues an error if quotations are nested more deeply. Alternatively, it can reuse the outer and inner quotes on further quotation levels. This alternative behavior is enabled implicitly when increasing the value of the \opt{maxlevel} option. The minimum is~\texttt{2}.

\optitem[american]{style}{\prm{style}}

This option selects a fixed quotation style. The style is used throughout the document unless it is changed manually, see section \ref{bas:set} for details. This option implicitly sets \kvopt{babel}{false}. Please refer to tables \ref{tab:sty} and \ref{tab:als} for a list of available quote styles and aliases. See sections \ref{cfg:sty}, \ref{cfg:als}, and \ref{cfg:spl} for instructions on adding or modifying quote styles.

\begin{table}
\tablesetup
\begin{tabularx}{\columnwidth}{@{}P@{}X@{}}
  \toprule
  \multicolumn{1}{@{}H}{Option key} & \multicolumn{1}{@{}H}{Possible values} \\
  \cmidrule(r){1-1}\cmidrule{2-2}
  danish	& quotes, guillemets \\
  english	& american, british\\
  french	& quotes, quotes\*, guillemets, guillemets\*\\
  german	& quotes, guillemets, swiss \\
  italian	& quotes, guillemets \\
  norwegian	& guillemets, quotes \\
  portuguese	& portuguese, brazilian \\
  spanish	& spanish, mexican \\
  swedish	& quotes, guillemets, guillemets\*\\
  \bottomrule
\end{tabularx}
\caption[Language options]{Language options defined by default}
\label{tab:lng}
\end{table}

\varitem{language}{\prm{variant}}

Use the language options listed in table \ref{tab:lng} to choose a style variant if there is more than one for a certain language. The first variant in the list is the default for the respective style. In the following example, the \opt{babel} option causes \sty{csquotes} to continuously adapt the quote style to the current language using the default style for that language. The defaults for German and Norwegian are changed:

\begin{ltxcode}
\usepackage[english,ngerman]{babel}
\usepackage[babel,german=guillemets,norwegian=quotes]{csquotes}
\end{ltxcode}
%
Note that \sty{babel}'s language name is \opt{ngerman} here whereas \sty{csquotes} uses \opt{german}. When selecting a quote style automatically, this package will essentially normalize the language names first, using a list of aliases which map languages to quote styles. See table \ref{tab:als} for details. Table \ref{tab:lng} indicates the language options defined by default. Additional options may be defined in the configuration file. See sections \ref{cfg:opt} and \ref{cfg:spl} for details. Also see section \ref{hnt:pre} for some additional notes concerning the predefined styles.

\end{optionlist}

\section{Basic interface}
\label{bas}

This package supports two ways to tag quotations: built-in commands and active quotes defined in the document preamble or the configuration file. This section will introduce the basic commands, active quotes are discussed in section \ref{act}. When working with automated citations, you might also want to learn about the integrated quotation facilities presented in section \ref{cit}.

\subsection{Quoting regular text}
\label{bas:reg}

The most basic command will simply enclose its argument in quotation marks:

\begin{ltxsyntax}

\cmditem{enquote}{text}
\cmditem*{enquote*}{text}

Like all quotation facilities, this command is context sensitive. Depending on the nesting level, it will toggle between outer and inner quotation marks with plain and nested quotations. The starred version of this command skips directly to the inner level. If multilingual support is enabled, the style of all quotation marks will be adapted to the current language.

\end{ltxsyntax}

\subsection{Quoting text in a foreign language}
\label{bas:bbl}

To facilitate typesetting quotations in a foreign language, there are two commands which combine \cmd{enquote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{foreignquote}{lang}{text}
\cmditem*{foreignquote*}{lang}{text}

This command combines \cmd{enquote} with \cmd{foreignlanguage}. It switches hyphenation patterns and enables the extra definitions provided by the \sty{babel} package for \prm{lang}, which must be a language name known to \sty{babel}. The quotation marks will match the language of the quoted piece of text.

\cmditem{hyphenquote}{lang}{text}
\cmditem*{hyphenquote*}{lang}{text}

This command combines \cmd{enquote} with the \env{hyphenrules} environment, that is, it merely switches hyphenation patterns. The quotation marks will match the language of the text surrounding the quotation.

\end{ltxsyntax}

\subsection{Formal quoting of regular text}
\label{bas:txt:reg}

Formal quotations are always accompanied by a citation indicating the source of the quoted text. The following command is an extended version of \cmd{enquote} which encloses the quoted piece of text in quotation marks and adds a citation after the quotation:

\begin{ltxsyntax}

\cmditem{textquote}[cite][punct]{text}
\cmditem*{textquote*}[cite][punct]{text}

The argument \prm{text} may be any arbitrary piece of text to be enclosed in quotation marks. The optional arguments \prm{cite} and \prm{punct} specify the citation and any terminal punctuation which is not part of \prm{text}. See section \ref{cfg:aux} on how to change the way these arguments are handled. The starred version of this command skips directly to the inner quotation level. Here are some usage examples:

\begin{ltxcode}
\textquote{...}
\textquote[][?]{...}
\textquote[Doe 1990, 67]{...}
\textquote[{\cite[67]{doe90}}]{...}
\end{ltxcode}
%
Note the use of the optional arguments in the examples above. As shown in the second example, \prm{cite} has to be given whenever \prm{punct} is used, even if it is empty. Also keep in mind that an optional argument containing square brackets must be wrapped in an additional pair of curly braces as shown in the last example. When working with automated citations, you might also want to learn about the integrated quotation facilities presented in section \ref{cit}.

\end{ltxsyntax}

\subsection{Formal quoting of text in a foreign language}
\label{bas:txt:bbl}

There are two additional commands which combine \cmd{textquote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{foreigntextquote}{lang}[cite][punct]{text}
\cmditem*{foreigntextquote*}{lang}[cite][punct]{text}

This command combines \cmd{textquote} with \cmd{foreignlanguage}. Apart from the language, the arguments are handled as with \cmd{textquote}.

\cmditem{hyphentextquote}{lang}[cite][punct]{text}
\cmditem*{hyphentextquote*}{lang}[cite][punct]{text}

This command combines \cmd{textquote} with the \env{hyphenrules} environment. Apart from the language, the arguments are handled as with \cmd{textquote}.

\end{ltxsyntax}

\subsection{Block quoting of regular text}
\label{bas:blk:reg}

A common requirement in academic writing demands that quotations be embedded in the text if they are short but set off as an indented paragraph if they are longer than a certain number of lines. In the latter case no quotation marks are inserted. The following command deals with this requirement automatically:

\begin{ltxsyntax}

\cmditem{blockquote}[cite][punct]{text}

This command determines the number of lines required to typeset \prm{text}. If \prm{text} is longer than a given number of lines or if it spans more than one paragraph, it is wrapped in a block quotation environment. Otherwise \cmd{blockquote} behaves like \cmd{textquote}. Quotations in footnotes, parboxes, minipages, and floats are always set inline. By default, the threshold is three lines and the environment used for long quotations is the \env{quote} environment. See section \ref{cfg:blk} on how to change these parameters. The optional arguments \prm{cite} and \prm{punct} specify the citation and any terminal punctuation which is not part of \prm{text}. See section \ref{cfg:aux} on how to change the way these arguments are handled.

\end{ltxsyntax}

\subsection{Block quoting of text in a foreign language}
\label{bas:blk:bbl}

There are two additional commands which combine \cmd{blockquote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{foreignblockquote}{lang}[cite][punct]{text}

This command behaves the same as \cmd{foreignquote} if the quotation is short. If it exceeds the threshold or spans several paragraphs, it will be wrapped in an \env{otherlanguage*} environment which is in turn wrapped in a block quotation environment. The arguments are handled as with \cmd{blockquote}.

\cmditem{hyphenblockquote}{lang}[cite][punct]{text}

This command works like \cmd{hyphenquote} if the quotation is short. If it exceeds the threshold or spans several paragraphs, it will be wrapped in an \env{hyphenrules} environment which is in turn wrapped in a block quotation environment. The arguments are handled as with \cmd{blockquote}.

\end{ltxsyntax}

\subsection{Selecting quote styles}
\label{bas:set}

Quote styles may be selected manually at any point in the document body by way of the following command:

\begin{ltxsyntax}

\cmditem{setquotestyle}[variant]{style}
\cmditem*{setquotestyle}{alias}
\cmditem*{setquotestyle}*

The regular form of this command selects a quote style and disables multilingual support. Its mandatory argument may be a quote style or an alias. If it is a quote style, the optional argument indicates the style variant. The starred version, which takes no arguments, enables multilingual support. Please refer to tables \ref{tab:sty} and \ref{tab:als} for a list of available styles, style variants, and language aliases.

\end{ltxsyntax}

\section{Active quotes}
\label{act}

This package also supports active characters corresponding to the commands presented in section \ref{bas}. Roughly speaking, an active character is a single character which functions as a command. Like the corresponding control sequences, active quotes are fully"=fledged markup elements which verify the nesting level and issue an error if quotations are nested in an invalid way. If multilingual support is enabled, the style of all quotation marks will be adapted to the current language. The commands presented in the following allocate such active quotes. They may be used in the configuration file, the preamble, or the document body. Note that all characters are automatically checked for validity as they are allocated. This package will reject characters which are unsuitable as active quotes. See section \ref{hnt:val} for details on the characters which may be used as active quotes.

\subsection{Quoting regular text}
\label{act:reg}

\cmd{MakeOuterQuote} and \cmd{MakeInnerQuote} define active quotes which print outer and inner quotation marks. Both take one mandatory argument, the character serving as both opening and closing mark:

\begin{ltxsyntax}

\cmditem{MakeOuterQuote}{character}
\cmditem{MakeInnerQuote}{character}

\cmd{MakeAutoQuote} defines active quotes which toggle between outer and inner quotations automatically. The two mandatory arguments serve as opening and closing mark and must be distinct:

\cmditem{MakeAutoQuote}{character 1}{character 2}
\cmditem*{MakeAutoQuote*}{character 1}{character 2}

All active quotes defined with \cmd{MakeAutoQuote} work like \cmd{enquote}. Those defined with \cmd{MakeOuterQuote} and \cmd{MakeInnerQuote} cover only a part of this functionality. The former correspond to the outer level of \cmd{enquote} whereas the latter correspond to the starred version. \cmd{MakeAutoQuote*} is similar to \cmd{MakeInnerQuote}, i.e. it corresponds to \cmd{enquote*}.

\end{ltxsyntax}

\subsection{Quoting text in a foreign language}
\label{act:bbl}

These commands combine \cmd{MakeAutoQuote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{MakeForeignQuote}{lang}{character 1}{character 2}
\cmditem*{MakeForeignQuote*}{lang}{character 1}{character 2}
\cmditem{MakeHyphenQuote}{lang}{character 1}{character 2}
\cmditem*{MakeHyphenQuote*}{lang}{character 1}{character 2}

The active quotes defined with the above commands are similar in function to \cmd{foreignquote} and \cmd{hyphenquote}, respectively. The starred variants correspond to \cmd{foreignquote*} and \cmd{hyphenquote*}.

\end{ltxsyntax}

\subsection{Block quoting of regular text}
\label{act:blk:reg}

\cmd{MakeBlockQuote} defines active quotes which will set quotations inline or as a separate paragraph, depending on their length. This command takes three mandatory arguments which must be distinct:

\begin{ltxsyntax}

\cmditem{MakeBlockQuote}{character 1}{delimiter}{character 2}

The arguments are automatically checked for validity, see section \ref{hnt:val} for details. All active quotes defined with \cmd{MakeBlockQuote} behave essentially the same as \cmd{blockquote}, but the handling of the citation is slightly different. \prm{character 1} will serve as the opening mark in the source file, \prm{character 2} as the closing one. The character indicated by the middle argument \prm{delimiter} will serve as a delimiter separating the quoted text from the citation which is given last as the active quotes are used:

\begin{ltxcode}
\MakeBlockQuote{<}{|}{>}
...
<text|citation>
\end{ltxcode}
%
If the delimiter is omitted, the entire text between the opening and the closing mark will be treated as quotation text. See the tutorial for more usage examples.

\end{ltxsyntax}

\subsection{Block quoting of text in a foreign language}
\label{act:blk:bbl}

These commands combine \cmd{MakeBlockQuote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{MakeForeignBlockQuote}{lang}{character 1}{delimiter}{character 2}
\cmditem{MakeHyphenBlockQuote}{lang}{character 1}{delimiter}{character 2}

The active quotes defined with \cmd{MakeForeignBlockQuote} behave essentially the same as \cmd{foreignblockquote}. Those defined with \cmd{MakeHyphenBlockQuote} work like \cmd{hyphenblockquote}. The behavior of the delimiter character is similar to \cmd{MakeBlockQuote}.

\end{ltxsyntax}

\subsection{Controlling active quotes}
\label{act:ctl}

The commands introduced above merely allocate active quotes, but these characters are not immediately made active. All allocated quotes are automatically enabled at the beginning of the document body. If any active quotes are allocated in the document body, they need to be enabled with \cmd{EnableQuotes}. The following commands control the state of the active quotes within a local scope.

\begin{ltxsyntax}

\csitem{EnableQuotes}
Enables all active quotes by redefining the allocated characters and making them active. It also restores them when disabled, set to verbatim, or overwritten.

\csitem{DisableQuotes}
Disables all active quotes by restoring the original category codes and definitions of all allocated characters.

\csitem{VerbatimQuotes}
Switches to verbatim active quotes. All active quotes will be printed verbatim until their default behavior is restored with \cmd{EnableQuotes}.

\csitem{DeleteQuotes}
Disables and deallocates all active quotes, i.e. performs a complete reset of all allocated characters so that they may be newly defined.

\end{ltxsyntax}

\section{Integrated interface}
\label{cit}

The commands presented in this section are extended versions of some of those discussed in section \ref{bas}. They differ from their counterparts in that they integrate automated citations into their syntax. Instead of adding \cmd{cite} manually, you pass the citation arguments to the respective quotation command. See section \ref{cfg:blk} on how to use a command other than \cmd{cite} to handle the citations.

\subsection{Formal quoting of regular text}
\label{cit:txt:reg}

The most basic integrated command is an extended version of \cmd{textquote}:

\begin{ltxsyntax}

\cmditem{textcquote}[prenote][postnote]{key}[punct]{text}
\cmditem*{textcquote*}[prenote][postnote]{key}[punct]{text}

\prm{text} may be any arbitrary piece of text. The optional argument \prm{punct} specifies any terminal punctuation which is not part of \prm{text}. See section \ref{cfg:aux} on how to change the way this argument is handled. The starred version of this command skips directly to the inner quotation level. The remaining arguments are handed over to \cmd{cite}. Note that \cmd{cite} normally supports one optional argument only. \prm{prenote} is only available in conjunction with the \sty{natbib}, \sty{jurabib}, and \sty{biblatex} packages. How these arguments are handled depends on the citation command. With \sty{natbib} and \sty{biblatex}, \prm{prenote} is in fact a notice such as <see>. With jurabib, this argument has a different function by default. The argument \prm{postnote}, which is always available, indicates the citation postnote. This is usually a page number. \prm{key} is the citation key. See sections \ref{cfg:blk} and \ref{cfg:aux} on how to customize the citation. Also see the tutorial for usage examples.

\end{ltxsyntax}

\subsection{Formal quoting of text in a foreign language}
\label{cit:txt:bbl}

These commands combine \cmd{textcquote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{foreigntextcquote}{lang}[prenote][postnote]{key}[punct]{text}
\cmditem*{foreigntextcquote*}{lang}[prenote][postnote]{key}[punct]{text}

This command combines \cmd{textcquote} with \cmd{foreignlanguage}. The handling of the arguments is similar to \cmd{textcquote}.

\cmditem{hyphentextcquote}{lang}[prenote][postnote]{key}[punct]{text}
\cmditem*{hyphentextcquote*}{lang}[prenote][postnote]{key}[punct]{text}

This command combines \cmd{textcquote} with the \env{hyphenrules} environment. The handling of the arguments is similar to \cmd{textcquote}.

\end{ltxsyntax}

\subsection{Block quoting of regular text}
\label{cit:blk:reg}

Block quotations may be combined with automated citations as well. The core of the integrated block quotation facilities is an extended version of \cmd{blockquote}:

\begin{ltxsyntax}

\cmditem{blockcquote}[prenote][postnote]{key}[punct]{text}

The difference between \cmd{blockcquote} and \cmd{blockquote} is that there are three citation arguments instead of one. The handling of these citation arguments is similar to \cmd{textcquote}; see section \ref{cit:txt:reg} for details. Also see sections \ref{cfg:blk} and \ref{cfg:aux} on how to customize block quotations.

\end{ltxsyntax}

\subsection{Block quoting of text in a foreign language}
\label{cit:blk:bbl}

These commands combine \cmd{blockcquote} with \sty{babel}'s language switches:

\begin{ltxsyntax}

\cmditem{foreignblockcquote}{lang}[prenote][postnote]{key}[punct]{text}

This command combines \cmd{blockcquote} with \cmd{foreignlanguage}. Long quotations will be wrapped in an \env{otherlanguage*} environment. The handling of the citation arguments is similar to \cmd{textcquote}.

\cmditem{hyphenblockcquote}{lang}[prenote][postnote]{key}[punct]{text}

This command combines \cmd{blockcquote} with the \env{hyphenrules} environment. The handling of the citation arguments is similar to \cmd{textcquote}.

\end{ltxsyntax}

\section{Display environments}
\label{env}

The environments introduced in this section will typeset quotations as a separate paragraph which looks exactly like a long quotation set by means of the block quotation facilities. Use them for quotations which are to be presented as a separate paragraph regardless of their length. Note that these environments are not replacements for the standard \env{quote} environment in the strict sense. They function as an additional layer on top of the latter, just like the block quotation facilities. The advantage of using these environments instead of resorting to the standard \env{quote} environment is that they are configurable, support citations, and will always be in sync with the block quotation facilities with respect to the configuration options discussed in sections \ref{cfg:blk} and \ref{cfg:aux}.

\subsection{Basic display environments}
\label{env:bas}

The arguments of all display environments are generally appended to the \cmd{begin} section of the environment:

\begin{ltxsyntax}

\envitem{displayquote}[cite][punct]

The two optional arguments of this environment specify the citation and any terminal punctuation which is not part of the quoted text. The citation will be inserted at the end of the environment. Trailing horizontal white space at the end of the environment is removed automatically. See sections \ref{cfg:blk} and \ref{cfg:aux} on how to customize the display environments. There are two additional environments which combine \env{displayquote} with \sty{babel}'s language switches:

\envitem{foreigndisplayquote}{lang}[cite][punct]

This environment combines \env{displayquote} with \env{otherlanguage*}. Apart from the language, the arguments are handled as with \env{displayquote}.

\envitem{hyphendisplayquote}{lang}[cite][punct]

This environment combines \env{displayquote} with \env{hyphenrules}. Apart from the language, the arguments are handled as with \env{displayquote}.

\end{ltxsyntax}

\subsection{Integrated display environments}
\label{env:int}

The following environment is an extended version of \env{displayquote}:

\begin{ltxsyntax}

\envitem{displaycquote}[prenote][postnote]{key}[punct]

The difference is that there are three citation arguments instead of one in this case. The placement of the citation is similar to \env{displayquote}. The citation arguments are handled as with \cmd{textcquote}; see section \ref{cit:txt:reg} for details. Also see sections \ref{cfg:blk} and \ref{cfg:aux} on how to customize this environment. There are two environments which combine \env{displaycquote} with \sty{babel}'s language switches:

\envitem{foreigndisplaycquote}{lang}[prenote][postnote]{key}[punct]

This environment combines \env{displaycquote} with \env{otherlanguage*}. Apart from the language, the arguments are handled as with \env{displaycquote}.

\envitem{hyphendisplaycquote}{lang}[prenote][postnote]{key}[punct]

This environment combines \env{displaycquote} with \env{hyphenrules}. Apart from the language, the arguments are handled as with \env{displaycquote}.

\end{ltxsyntax}

\clearpage

\section{Configuration}
\label{cfg}

If available, this package will load the configuration file \path{csquotes.cfg}. You may use this file to define new quote styles and aliases or redefine existing ones.

\begin{table}
\tablesetup
\begin{tabularx}{\columnwidth}{@{}P@{}X@{}}
  \toprule
  \multicolumn{1}{@{}H}{Quote style} & \multicolumn{1}{@{}H}{Style variants} \\
  \cmidrule(r){1-1}\cmidrule{2-2}
  danish	& quotes, guillemets \\
  dutch		& -- \\
  english	& american, british\\
  finnish	& -- \\
  french	& quotes, quotes\*, guillemets, guillemets\*\\
  german	& quotes, guillemets, swiss \\
  greek		& -- \\
  italian	& quotes, guillemets \\
  norwegian	& guillemets, quotes \\
  portuguese	& portuguese, brazilian \\
  russian	& -- \\
  spanish	& spanish, mexican \\
  swedish	& quotes, guillemets, guillemets\*\\
  \bottomrule
\end{tabularx}
\caption[Styles and variants]{Quote styles and style variants defined by default}
\label{tab:sty}
\end{table}

\subsection{Defining quote styles}
\label{cfg:sty}

Use the following command to define quote styles and style variants:

\begin{ltxsyntax}

\cmditem{DeclareQuoteStyle}[variant]{style}[outer init][inner init]\\
{opening outer mark}[middle outer mark]{closing outer mark}[kern]\\
{opening inner mark}[middle inner mark]{closing inner mark}

This command may be used in the configuration file or in the document preamble. The term <outer> refers to the first quotation level, <inner> means quotations within another quotation. A <middle mark> is a quotation mark inserted at the beginning of every paragraph within a quotation spanning multiple paragraphs. In most cases, the arguments defining the quotation marks will simply contain one of the commands listed in table \ref{tab:out}. If both an outer and an inner quotation begin or end simultaneously, the kerning specified by the value \prm{kern} will be inserted between the adjoining quotation marks. While this value can be given in any unit known to \tex, it is advisable to use the relative, font"=dependent unit <em> instead of absolute units such as points, inches, or millimeters. Note that \prm{kern} is used as a fallback value only. If the font provides kerning data for the respective pair of quotation marks the font's kerning takes precedence. \prm{outer init} and \prm{inner init} are all"=purpose hooks initializing the quote style. Selecting a quote style will make these hooks available to all quotation commands without expanding them. The execution of \prm{outer init} will take place immediately before the opening outer quote is inserted, but inside the group formed by the quotation. \prm{inner init} is executed before the opening inner quote is inserted. It is advisable to avoid any global assignments in this context to prevent interference with other styles. Whenever \prm{inner init} is used \prm{outer init} has to be given as well, even if the argument is empty. Refer to table \ref{tab:sty} for a list of all predefined quote styles and their variants. These are the backend styles only, see also table \ref{tab:als} for a list of language aliases. See section \ref{cfg:spl} for some examples as well as an illustration of how quote styles, aliases, and package options interact.

\end{ltxsyntax}

\subsection{Defining quote aliases}
\label{cfg:als}

The following command defines quote aliases:

\begin{ltxsyntax}

\cmditem{DeclareQuoteAlias}[variant]{style}{alias}
\cmditem*{DeclareQuoteAlias}{first-level alias}{second-level alias}

This command may be used in the configuration file or in the document preamble. The alias may point to a backend style or to another alias. Most language aliases refer to a backend style, but some point to an intermediate alias instead. If the alias is defined for the sake of the \sty{babel} package, its name must be identical to the language name used by \sty{babel}, i.e. the expansion of \cmd{languagename}. See section \ref{cfg:spl} for an illustration of how quote styles, aliases, and package options interact. A list of all aliases defined by default is given in table \ref{tab:als}.

\end{ltxsyntax}

\begin{table}
\tablesetup
\begin{tabularx}{\columnwidth}{@{}Q@{}X@{}Q@{}X@{}}
  \toprule
  \multicolumn{1}{@{}H}{Alias} & \multicolumn{1}{@{}H}{Backend style or alias} &
  \multicolumn{1}{@{}H}{Alias} & \multicolumn{1}{@{}H}{Backend style or alias} \\
  \cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(r){3-3}\cmidrule{4-4}
  american	& english/american	&
	  naustrian	& austrian		\\
  australian	& english/british	&
	  newzealand	& english/british	\\
  austrian	& german/quotes		&
	  ngerman	& german		\\
  brazil	& brazilian 		&
	  norsk		& norwegian		\\
  brazilian	& portuguese/brazilian	&
	  norwegian	& norwegian/guillemets	\\
  british	& english/british	&
	  nynorsk	& norwegian		\\
  canadian	& english/american	&
	  portuges	& portuguese		\\
  danish	& danish/quotes		&
	  portuguese	& portuguese/portuguese \\
  english	& english/american	&
	  spanish	& spanish/spanish	\\
  french	& french/quotes		&
	  swedish	& swedish/quotes	\\
  german	& german/quotes		&
	  swiss		& german/swiss		\\
  italian	& italian/quotes	&
	  UKenglish	& british		\\
  mexican	& spanish/mexican	&
	  USenglish	& american		\\
  \bottomrule
\end{tabularx}
\caption[Language aliases]{Language aliases defined by default}
\label{tab:als}
\end{table}

\subsection{Defining package options}
\label{cfg:opt}

The following command creates a new package option based on a key\slash value syntax. It takes one mandatory argument, the quote style name:

\begin{ltxsyntax}

\cmditem{DeclareQuoteOption}{style}

When using the new option, the name of the quote style will serve as the key. The value may be any style variant defined for the respective style. The package option will select a variant by defining an alias pointing to the desired backend style. This command is available in the configuration file only. See section \ref{cfg:spl} for an illustration of how quote styles, aliases, and package options interact.

\end{ltxsyntax}

\subsection{Executing package options}
\label{cfg:exe}

Apart from passing options to this package as it is loaded, you may also execute options using the following command:

\begin{ltxsyntax}

\cmditem{ExecuteQuoteOptions}{key=value,\,\dots}

This command permits presetting package options in the configuration file. It may also be used in the document preamble.

\end{ltxsyntax}

\subsection{Adding a new quote style}
\label{cfg:spl}

This section will give some comprehensive examples of how to define new quote styles. The examples presented here will only make use of the most basic components a quote style can be composed of. The main point is to illustrate the interaction of quote styles, variants, aliases, and package options. To get started, consider a simple house style which may be selected by way of the package option \opt{style} or the command \cmd{setquotestyle}:

\begin{ltxcode}
\DeclareQuoteStyle{house}
  {\textquotedblleft}{\textquotedblright}
  {\textquoteleft}{\textquoteright}
\end{ltxcode}
%
Now suppose that we wanted to add a quote style for an imaginary language called Newspeak and that there were two quote styles commonly used in Newspeak, an official one and an unofficial one. In this case, we need two backend styles implemented as variants of the \opt{newspeak} style, \opt{newspeak/official} and \opt{newspeak/unofficial}:

\begin{ltxcode}
\DeclareQuoteStyle[official]{newspeak}
  {\textquotedblleft}{\textquotedblright}
  {\textquoteleft}{\textquoteright}
\DeclareQuoteStyle[unofficial]{newspeak}
  {\textquotedblright}{\textquotedblleft}
  {\textquoteright}{\textquoteleft}
\end{ltxcode}
%
The official variant should be the default for this style. There is no need to copy the definition of the \opt{official} variant to accomplish that. We simply define an alias labeled \opt{newspeak} which points to the desired variant:

\begin{ltxcode}
\DeclareQuoteAlias[official]{newspeak}{newspeak}
\end{ltxcode}
%
The reason why we are using variants and aliases instead of two independent styles will become clear in a moment. Suppose that the \sty{babel} package offered support for Newspeak, but this language was known to \sty{babel} as \opt{otherspeak}:

\begin{ltxcode}
\DeclareQuoteAlias{newspeak}{otherspeak}
\end{ltxcode}
%
This is an example of a second"=level alias pointing to a first"=level alias. If the current language is \opt{otherspeak}, the above aliases will be expanded as follows:

\begin{lstlisting}[style=plain]{}
otherspeak = newspeak = newspeak/official
\end{lstlisting}
%
We also define a new package option to choose a style variant:

\begin{ltxcode}
\DeclareQuoteOption{newspeak}
\end{ltxcode}
%
This will add a new package option with a key called \opt{newspeak}. The value of this option may be any variant of the \opt{newspeak} style defined in the configuration file. In this example, there are two possible values: \opt{official} and \opt{unofficial}. To select the default or the alternative style for the entire document we use:

\begin{ltxcode}
\usepackage[style=newspeak]{csquotes}
\usepackage[style=newspeak,newspeak=unofficial]{csquotes}
\end{ltxcode}
%
To select the default or the alternative style with multilingual support we use:

\begin{ltxcode}
\usepackage[babel]{csquotes}
\usepackage[babel,newspeak=unofficial]{csquotes}
\end{ltxcode}
%
The base style must be implemented as an alias in this case since the \opt{newspeak} option will select a variant by redefining and thus overwriting the \opt{newspeak} alias. Since the \opt{otherspeak} alias points to \opt{newspeak} and not directly to any backend style, using the \opt{newspeak} option will also have the desired effect if multilingual support is enabled. Note that there are some style names which have a special meaning. See section \ref{hnt:pre} for details.

\subsection{Defining quotes for \pdf strings}
\label{cfg:pdf}

The following command specifies the quotation marks for \pdf strings:

\begin{ltxsyntax}

\cmditem{DeclarePlainStyle}{opening outer mark}{closing outer mark}\\
{opening inner mark}{closing inner mark}

This command may be used in the configuration file or in the document preamble. By default, outer quotations get straight double quotes and inner quotations straight single quotes. See section \ref{hnt:pdf} for additional hints concerning \pdf strings.

\end{ltxsyntax}

\subsection{Configuring quotations and citations}
\label{cfg:blk}

The following commands change the default values used by various quotation facilities of this package:

\begin{ltxsyntax}

\cmditem{SetBlockThreshold}{integer}
\cmditem{SetBlockEnvironment}{environment}
\cmditem{SetCiteCommand}{command}

\cmd{SetBlockThreshold} changes the number of lines the block quotation facilities use as a threshold when deciding whether a quotation should be set inline or as a block quotation. The default is three lines. \cmd{SetBlockEnvironment} specifies the environment used for block and display quotations. It takes the name of an existing environment as its argument. The default is the \env{quote} environment provided by most document classes. The argument to \cmd{SetCiteCommand} specifies a replacement for \cmd{cite} which will be used by all integrated quotation facilities to handle citations. It must be a single command which takes one or two optional arguments followed by a mandatory one, the citation key. The default is \cmd{cite}. The commands affected by these parameters are indicated in table \ref{tab:blk}.

\end{ltxsyntax}

\begin{table}
\tablesetup
\let\+\tickmarkyes
\let\_\tickmarkno
\begin{tabularx}{\columnwidth}{@{}X@{}*{21}{@{}c}@{}}
  \toprule
  \multicolumn{1}{@{}H}{Parameter} & \multicolumn{21}{@{}H}{Command or environment} \\
  \cmidrule{2-22}
  & \vcmd{enquote}
  & \vcmd{foreignquote}
  & \vcmd{hyphenquote}
  & \vcmd{textquote}
  & \vcmd{foreigntextquote}
  & \vcmd{hyphentextquote}
  & \vcmd{textcquote}
  & \vcmd{foreigntextcquote}
  & \vcmd{hyphentextcquote}
  & \vcmd{blockquote}
  & \vcmd{foreignblockquote}
  & \vcmd{hyphenblockquote}
  & \vcmd{blockcquote}
  & \vcmd{foreignblockcquote}
  & \vcmd{hyphenblockcquote}
  & \venv{displayquote}
  & \venv{foreigndisplayquote}
  & \venv{hyphendisplayquote}
  & \venv{displaycquote}
  & \venv{foreigndisplaycquote}
  & \venv{hyphendisplaycquote} \\
  \cmidrule(r){1-1}\cmidrule{2-22}
  Threshold	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_\\
  Environment	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+\\
  Cite command	&\_&\_&\_&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+\\
  \bottomrule
\end{tabularx}
\caption[Configurable parameters]{Scope of configurable parameters}
\label{tab:blk}
\end{table}

\subsection{Hooks for quotations and citations}
\label{cfg:aux}

Apart from the environment specified with \cmd{SetBlockEnvironment}, which envelops both the quoted text and the citation, the quoted text (excluding the citation) of all long quotations is enclosed in an environment called \env{quoteblock}. This environment does nothing by default but it may be redefined to format the quoted text. In a similar manner, the text block (excluding the quotation marks) of inline quotations is enclosed in an environment called \env{quotetext}. Like \env{quoteblock}, this environment does nothing by default but it may be redefined if additional hooks are required to format the quoted text.

Other aspects of the behavior of the quotation facilities may also be customized at a lower level. All facilities which take a \prm{cite} argument will not insert it directly. They pass it to an auxiliary command called \cmd{mkcitation} which may be redefined to format the citation. When doing so, keep in mind that it must take exactly one mandatory argument. \cmd{mkcitation} will only be executed if there is a citation. The default behavior is to separate the citation from the preceding text by an interword space and enclose it in parentheses.

The integrated quotation facilities have slightly different requirements since the \cmd{cite} command may enclose the citation in parentheses or brackets. Therefore, they use \cmd{mkccitation} instead of \cmd{mkcitation}. The default behavior of this command is to separate the citation from the preceding text by an interword space. The default settings are equivalent to the following definitions:

\begin{table}
\tablesetup
\let\+\tickmarkyes
\let\_\tickmarkno
\begin{tabularx}{\columnwidth}{@{}X@{}*{21}{@{}c}@{}}
  \toprule
  \multicolumn{1}{@{}H}{Hook} & \multicolumn{21}{@{}H}{Command or environment} \\
  \cmidrule{2-22}
  & \vcmd{enquote}
  & \vcmd{foreignquote}
  & \vcmd{hyphenquote}
  & \vcmd{textquote}
  & \vcmd{foreigntextquote}
  & \vcmd{hyphentextquote}
  & \vcmd{textcquote}
  & \vcmd{foreigntextcquote}
  & \vcmd{hyphentextcquote}
  & \vcmd{blockquote}
  & \vcmd{foreignblockquote}
  & \vcmd{hyphenblockquote}
  & \vcmd{blockcquote}
  & \vcmd{foreignblockcquote}
  & \vcmd{hyphenblockcquote}
  & \venv{displayquote}
  & \venv{foreigndisplayquote}
  & \venv{hyphendisplayquote}
  & \venv{displaycquote}
  & \venv{foreigndisplaycquote}
  & \venv{hyphendisplaycquote} \\
  \cmidrule(r){1-1}\cmidrule{2-22}
  \cmd{mkcitation}	&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+&\_&\_&\_\\
  \cmd{mkccitation}	&\_&\_&\_&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+&\_&\_&\_&\+&\+&\+\\
  \cmd{mkpretextpunct}	&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_\\
  \cmd{mkmidtextpunct}	&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_\\
  \cmd{mkfintextpunct}	&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_\\
  \cmd{mkpreblockpunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_\\
  \cmd{mkmidblockpunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_\\
  \cmd{mkfinblockpunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_\\
  \cmd{mkpredisppunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+\\
  \cmd{mkmiddisppunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+\\
  \cmd{mkfindisppunct}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+\\
  \env{quotetext}	&\_&\_&\_&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\_&\_&\_&\_&\_&\_\\
  \env{quoteblock}	&\_&\_&\_&\_&\_&\_&\_&\_&\_&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+&\+\\
  \bottomrule
\end{tabularx}
\caption[Auxiliary hooks]{Availability of auxiliary hooks}
\label{tab:aux}
\end{table}

\begin{ltxcode}[showspaces=true]
\newcommand*{<<\mkcitation>>}[1]{ (#1)}
\newcommand*{<<\mkccitation>>}[1]{ #1}
\end{ltxcode}
%
As the block quotation facilities switch between inline and display quotations, changes to the terminal punctuation may be required. The punctuation is controlled by three hooks: \cmd{mkpreblockpunct} is executed before the closing quotation mark. \cmd{mkmidblockpunct} is executed after the closing quotation mark, between the quotation and the citation. \cmd{mkfinblockpunct} is executed after the citation. These hooks serve two purposes. They control the placement of the \prm{punct} argument and they may also be used to insert additional punctuation. Like the \prm{cite} argument, \prm{punct} is not inserted directly. It is passed to all three hooks. When redefining these commands, keep in mind that all of them must take one mandatory argument, but only one of them should insert it. By default, the punctuation is inserted after the citation. This is equivalent to the following definitions:

\begin{ltxcode}
\newcommand*{<<\mkpreblockpunct>>}[1]{}
\newcommand*{<<\mkmidblockpunct>>}[1]{}
\newcommand*{<<\mkfinblockpunct>>}[1]{#1}
\end{ltxcode}
%
The text quotation facilities also take a \prm{punct} argument whose placement is controlled by \cmd{mkpretextpunct}, \cmd{mkmidtextpunct}, and \cmd{mkfintextpunct}. These commands work like their counterparts for block quotations. Their default behavior is equivalent to the following definitions:

\begin{ltxcode}
\newcommand*{<<\mkpretextpunct>>}[1]{}
\newcommand*{<<\mkmidtextpunct>>}[1]{}
\newcommand*{<<\mkfintextpunct>>}[1]{#1}
\end{ltxcode}
%
The hooks \cmd{mkpredisppunct}, \cmd{mkmiddisppunct}, and \cmd{mkfindisppunct} handle the placement of the punctuation argument passed to the display environments. The default behavior is equivalent to the following definitions:

\begin{ltxcode}
\newcommand*{<<\mkpredisppunct>>}[1]{}
\newcommand*{<<\mkmiddisppunct>>}[1]{}
\newcommand*{<<\mkfindisppunct>>}[1]{#1}
\end{ltxcode}
%
The difference between \cmd{mkpredisppunct} is \cmd{mkmiddisppunct} is subtle because there are no closing quotation marks in display quotations. The two hooks differ in that \cmd{mkpredisppunct} is executed before the \env{quoteblock} environment is closed whereas \cmd{mkmiddisppunct} is executed after this environment. This also applies to \cmd{mkpreblockpunct} and \cmd{mkmidblockpunct} in display mode. Table \ref{tab:aux} gives an overview of the facilities affected by a redefinition of the above hooks. See the tutorial for usage examples. Also see section \ref{cfg:tst} for tests which may be useful when redefining the above hooks.

\subsection{Additional tests in quotation hooks}
\label{cfg:tst}

The commands in this section increase the flexibility of the hooks discussed in section \ref{cfg:aux}. For example, it may be desirable to adjust the format of a citation depending on the way the corresponding quotation is typeset. The following command will test whether the quotation is set inline or as a separate paragraph:

\begin{ltxsyntax}

\cmditem{ifblockquote}{true}{false}

This command expands to \prm{true} with block and display quotations, and to \prm{false} otherwise. It may also be useful to known if the quotation ends with a punctuation mark, especially in the definition of the \cmd{mk...punct} hooks. The following tests provide information about the terminal punctuation:

\cmditem{ifquotepunct}{true}{false}
\cmditem{ifquoteterm}{true}{false}

The first command expands to \prm{true} if the quotation ends with any punctuation mark, and to \prm{false} otherwise. The second one will only expand to \prm{true} if the quotation ends with a terminal punctuation mark (period, exclamation mark, or question mark). The following commands allow for more specific tests:

\cmditem{ifquotecolon}{true}{false}
\cmditem{ifquotecomma}{true}{false}
\cmditem{ifquoteexclam}{true}{false}
\cmditem{ifquoteperiod}{true}{false}
\cmditem{ifquotequestion}{true}{false}
\cmditem{ifquotesemicolon}{true}{false}

Note that all of the above tests are designed for use in the definition of the hooks from section \ref{cfg:aux}. They will not yield meaningful results when used anywhere else. There is also a stand-alone test which may be used anywhere:

\cmditem{ifstringblank}{string}{true}{false}

This command expands to \prm{true} if \prm{string} is blank (empty or spaces), and to \prm{false} otherwise. This is useful to test for an empty argument in the definition of the \cmd{mk...punct} commands. Note that this test is redundant in the definition of the citation hooks because they are only executed if there is a citation.

\end{ltxsyntax}

\section{Hints and caveats}
\label{hnt}

\subsection{Input encodings}
\label{hnt:inc}

The active quotes provided by this package may depend on or benefit from the \sty{inputenc} package under certain circumstances. As long as the active quotes are in the range 0--127, there is no benefit in loading \sty{inputenc}. If you are using an 8-bit input encoding such as \opt{latin1}, \sty{inputenc} is required for the quotes to function properly in a verbatim context. It should therefore be loaded before any active quotes are allocated (not necessarily before this package is loaded). The \acr{UTF-8} support of this package builds on the \path{utf8} module of the inputenc package. When using this encoding, ensure that inputenc is loaded with the \opt{utf8} option. Do not use the \opt{utf8x} option as this would implicitly load the \sty{ucs} package which is not supported by \sty{csquotes}. \acr{UTF-8} encoding will be detected automatically. All commands discussed in section \ref{act} work as usual with this encoding. See also section~\ref{hnt:mod}.

\subsection{Output encodings}
\label{hnt:onc}

The \acr{OT1} font encoding, the default output encoding of \latex, merely includes the quotation marks used in English. You will need to switch to an encoding like \acr{T1} or \acr{LY1} in order to get guillemets or baseline quotation marks. This package deliberately refrains from providing any workarounds for the \acr{OT1} legacy encoding. If you need \acr{T1} encoding for some of the quotation marks, you will most likely need it anyway to get proper hyphenation for the respective language. See table \ref{tab:out} for a list of common quotation marks included in both \acr{T1} and \acr{LY1} encoding.

\begin{table}
\tablesetup
\begin{tabularx}{\columnwidth}{@{}X@{}p{60pt}X@{}p{60pt}@{}}
  \toprule
  \multicolumn{2}{@{}H}{Double quotation marks} & \multicolumn{2}{H}{Single quotation marks} \\
  \cmidrule(r){1-2}\cmidrule(l){3-4}
  \multicolumn{1}{@{}H}{Command} & \multicolumn{1}{@{}H}{Example} &
  \multicolumn{1}{H}{Command} & \multicolumn{1}{@{}H}{Example} \\
  \cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(lr){3-3}\cmidrule{4-4}
  \cmd{textquotedblleft}	& \mksample[60]{\textquotedblleft} &
  \cmd{textquoteleft}		& \mksample[60]{\textquoteleft} \\
  \cmd{textquotedblright}	& \mksample[60]{\textquotedblright} &
  \cmd{textquoteright}		& \mksample[60]{\textquoteright} \\
  \cmd{quotedblbase}		& \mksample[60]{\quotedblbase} &
  \cmd{quotesinglbase}		& \mksample[60]{\quotesinglbase} \\
  \cmd{guillemotleft}		& \mksample[60]{\guillemotleft} &
  \cmd{guilsinglleft}		& \mksample[60]{\guilsinglleft} \\
  \cmd{guillemotright}		& \mksample[60]{\guillemotright} &
  \cmd{guilsinglright}		& \mksample[60]{\guilsinglright} \\
  \bottomrule
\end{tabularx}
\caption[Quotation marks]{Quotation marks included in \acr{T1} and \acr{LY1} encoding}
\label{tab:out}
\end{table}

\subsection{Valid active quotes}
\label{hnt:val}

In general, an active quote may be any single character with category code 12 or 13, or any multibyte \acr{UTF-8} sequence representing a single character. However, there are a few exceptions: numbers, punctuation marks, the apostrophe, the hyphen, and all characters which are part of the \latex syntax are rejected. In sum, the following characters will be considered as reserved by this package: \texttt{A--Z a--z 0--9 . , ; : ! ? \textquotesingle\ - \# \$ \% \& \textasciicircum\ \textunderscore\ \textasciigrave\, \textasciitilde\ \textbackslash\ @ \textasteriskcentered\ \{ \} [ ]}

\subsection{Invalid nesting and unbalanced active quotes}
\label{hnt:grp}

Every quotation forms a group which includes both the quoted piece of text and the quotation marks. This package tracks the nesting level of all quotations and thus allows for basic validation. If quotations are nested in an invalid way, it will issue an error message. Keep in mind that the active quotes are more than a convenient way to enter quotation marks. They are fully"=fledged markup elements which imply grouping as well, hence they must always be balanced and must not interfere with other group boundaries. This package ensures that an error is triggered if quotes are unbalanced or nested in an invalid way. However, note that packages generally can not catch low-level errors caused by grouping mistakes, nor do they have any control over the wording of generic error messages.

\subsection{Active quotes in special contexts}
\label{hnt:mod}

The commands provided by this package are designed for use in text mode. If you inadvertently use them in math mode, they will issue an error message. Note that all active quotes retain their original function in math mode. It is perfectly possible to use a character like the greater-than symbol as an active quote without interfering with math mode.

In a verbatim context, the active quotes will normally be disabled. If a character is in the range 128--255, however, its original function is restored so that the \sty{inputenc} package may handle it in verbatim environments. This implies that \sty{inputenc} must be loaded before any active quotes are allocated. This feature is available with the standard verbatim environments as well as those provided by (or defined via) the packages \sty{verbatim}, \sty{fancyvrb}, \sty{moreverb}, and \sty{alltt}. This also applies to the \cmd{verb} command and the \sty{shortvrb} package. The \sty{listings} package provides dedicated support for extended input encodings. When using this package, activate its <extended characters> option and specify the input encoding. As of this writing, the \sty{listings} package does not support \acr{UTF-8} encoding.

Some care is still required when choosing active quotes. Note that you normally cannot use active characters in the argument to commands expecting a string of characters, such as \cmd{input}, \cmd{label}, or \cmd{cite}. There are two packages which try to remedy this situation: the \sty{babel} package and the \sty{underscore} package (when loaded with the \opt{strings} option). Both packages redefine several standard commands affected by this general problem. If any one of these packages is loaded, \sty{csquotes} will take advantage of all improvements automatically. Unfortunately, both packages patch a different set of commands and neither one covers all possibly vulnerable commands.

\subsection{\pdf strings and \sty{hyperref} support}
\label{hnt:pdf}

This package interfaces with the \sty{hyperref} package as \pdf strings such as bookmarks are generated. See section \ref{cfg:pdf} on how to configure the quotation marks used in \pdf strings. Support for \pdf strings is only available with the basic facilities presented in sections \ref{bas:reg} and \ref{bas:bbl} as well as \ref{act:reg} and \ref{act:bbl}. Be advised that the way \sty{hyperref} builds \pdf strings imposes severe limitations on the capabilities of all commands. Most notably, the nesting level of quotations cannot be tracked in this context. Nested quotations will generally get outer marks, but you may use starred commands or active inner quotes to request inner marks explicitly. If quotation marks are to be included in the document properties of a \pdf file, you must use \cmd{hypersetup} to specify the strings. The replacement mechanism will not function within the optional argument to \cmd{usepackage}. For information about \pdf strings see the \sty{hyperref} documentation.

\subsection{Footnotes inside quotations}
\label{hnt:ftn}

This package will automatically reset the nesting level within any footnote included in a quotation. If the \sty{babel} package has been loaded, it will also reset the language. The language of the footnote text including the hyphenation patterns will match the language of the text surrounding the quotation. This applies to parboxes, minipages, and floats as well.

\subsection{Using \sty{csquotes} with \sty{babel}'s shorthands}
\label{hnt:bbl}

The commands discussed in section \ref{aut:amk} may be combined with the shorthands of the \sty{babel} package such that \sty{babel} provides the user interface and \sty{csquotes} the backend. For example, the German module of the \sty{babel} package defines, amongst other things, the shorthands |"`| and |"'|. Such shorthands are input aids, \ie physical markup elements with a fixed definition. Typing |"`| is a short way of saying |\quotedblbase| but it is not different in concept. These shorthands can be transformed into <smart quotes> which behave like \cmd{enquote}. Here is a simple ad~hoc solution suitable for documents with only one language:

\begin{ltxexample}[upquote]
\documentclass{...}
\usepackage[german]{babel}
\usepackage[babel=once]{csquotes}
\defineshorthand{"`}{\openautoquote} 
\defineshorthand{"'}{\closeautoquote}
\end{ltxexample}
%
It is possible to move such definitions to \path{csquotes.cfg}. In this case, the code is slightly more complex because it needs to be more general:

\begin{ltxcode}[upquote]
\AtEndPreamble{%
  \@ifpackageloaded{babel}
    {\iflanguage{german}
       {\declare@shorthand{german}{"`}{\openautoquote}%
	\declare@shorthand{german}{"'}{\closeautoquote}}
       {}}
    {}}
\end{ltxcode}
%
This code redefines the shorthands only if the \sty{babel} package has been loaded and the main language is \texttt{german}. Note that \sty{babel}'s shorthands are language"=specific. The way they are configured and handled is technically and conceptually different from the active quotes discussed in section \ref{act}. Active quotes are defined globally and automatically adapt to the current language. With \sty{babel}, each language has its own set of shorthands. Also note that \sty{babel} uses \cmd{AtBeginDocument} to initialize the main document language, including the corresponding shorthands. We use \cmd{AtEndPreamble} to defer the code until the end of the preamble. This way, we can be sure that \sty{babel} has been loaded but that the main document language has not been initialized yet. See the \sty{babel} manual for further details. The \cmd{AtEndPreamble} command is provided by the \sty{etoolbox} package.

\subsection{Miscellaneous notes about the predefined styles}
\label{hnt:pre}

All variants of the \opt{french} style use spaced out guillemets as outer marks. The style variant \opt{quotes} uses double quotes as inner marks. The starred variant \opt{quotes*} is similar to its regular counterpart except that it will also space out the inner marks. The \opt{guillemets} variant employs spaced out guillemets on all levels. It will also insert guillemets at the beginning of every paragraph inside a quotation spanning multiple paragraphs. In addition to that, two adjoining marks at the end of a quotation are replaced by a single one; if two nested quotations end simultaneously, the second closing mark is omitted automatically. The starred variant \opt{guillemets*} is similar to its regular counterpart, differing only in the middle mark inserted at the beginning of every paragraph. The regular variant uses a left"=pointing guillemet whereas the starred one uses a right"=pointing one.

There are three styles which serve a special purpose: \opt{default}, \opt{fallback}, and \opt{debug}. The \opt{default} style is a dynamic alias pointing to the default quote style used if the multilingual interface is not enabled. The package option \opt{style} and the command \cmd{setquotestyle} will redefine this alias. The \opt{fallback} style is a backend style used as a fallback whenever the multilingual interface is enabled but there is no matching quote style for the current language. It will print bold question marks by default. The \opt{debug} style will not print quotation marks but the current quote level as a bold number. This style may be selected using the \opt{style} option or the \cmd{setquotestyle} command. It is intended for debugging only.

\section{Author interface}
\label{aut}

The following sections discuss the programmer interface to the \sty{csquotes} package as well as some details of the implementation. They are intended for class and package authors who want to interface with this package.

\subsection{Controlling active quotes}
\label{aut:ctl}

The author commands in this section behave essentially like the corresponding user commands discussed in section \ref{act:ctl}. The only difference is that they work quietly behind the scenes without writing any notices to the transcript file. The scope of these commands is local so that all changes may be confined to a group. Note that the active quotes are enabled at the beginning of the document body. Under no circumstances will this package make any characters active in the document preamble. You will only need the following commands when dealing with active quotes at the beginning of or in the document body.

\begin{ltxsyntax}

\csitem{@enablequotes}

This command enables all characters allocated as active quotes. It also restores their definitions if they were disabled or accidentally overwritten. With single-byte encodings, this command (re)defines all allocated characters and makes them active. With \acr{UTF-8} encoding, it redefines the internal macro used by the \sty{inputenc} package to typeset the respective \acr{UTF-8} sequence (\cmd{u8:}\prm{character}). \acr{UTF-8} characters in the range 0--127 are handled as with single-byte encodings.

\csitem{@disablequotes}

This command restores the \emph{status quo ante} of all active quotes. With single-byte encodings, there are two possible cases. (1) If a character had already been active when it was allocated as active quote, its former definition is restored. (2) If a character had not been active when it was allocated, its former category code is restored. With \acr{UTF-8} encoding, this command restores the former definition of the internal macro used by the \sty{inputenc} package to typeset the respective \acr{UTF-8} sequence. \acr{UTF-8} characters in the range 0--127 are handled as with single-byte encodings.

\csitem{@verbatimquotes}

For verbatim environments and similar applications, use this command rather than \cmd{@disablequotes}. It redefines the active quotes in a way that is better suited for verbatim typesetting. With single-byte encodings, it will do one of the following things. (1) If a character is in the range 0--127, it is redefined such that it expands to itself with category code 12. (2) If a character is in the range 128--255, there are two possibilities. (a) If it had already been active when it was allocated, its former definition is restored. (b) If it had not been active before, it is redefined such that it expands to itself with its former category code.

Characters in the range 0--127 are added to the \cmd{dospecials} list. Characters in the range 128--255 remain active, permitting the \sty{inputenc} package to typeset them verbatim (due to case 2a, which implies that you must load \sty{inputenc} before allocating active quotes). Case 2b is usually undesirable in verbatim environments. If \sty{inputenc} is loaded, however, this should not happen. With \acr{UTF-8} encoding, this command restores the former definition of the internal macro used by the \sty{inputenc} package to typeset the respective \acr{UTF-8} sequence. \acr{UTF-8} characters in the range 0--127 are handled as with single-byte encodings.

Due to case 1, \cmd{@verbatimquotes} itself is independent of any \cmd{dospecials} processing. You may typeset all active quotes verbatim by using this command exclusively. The advantage of this approach is that it does not require any category code changes, hence this command may also be used to modify an argument after it has been read. Also note that the standard \latex verbatim environments as well as all environments provided by or defined via the packages \sty{verbatim}, \sty{fancyvrb}, \sty{moreverb}, and \sty{alltt} are catered for automatically. This also applies to the \cmd{verb} command and the \sty{shortvrb} package.

\csitem{@deletequotes}

This command implicitly executes \cmd{@disablequotes} and deallocates all active quotes, which results in a complete reset of all active quotes so that they may be newly defined. This command should be used with care because the reset is not visible to the user. Using \cmd{DeleteQuotes} may be preferable.

\end{ltxsyntax}

\subsection{Active quotes in a strings-only context}
\label{aut:str}

A possible problem with active characters are strings-only contexts, i.\,e. cases in which an active character is used in the formation of a control sequence name. A typical example is the \cmd{label} command which expects a string of characters. Any active character may break \cmd{label} when used in its argument. There are two packages which try to remedy this situation, albeit in different ways: \sty{babel} and \sty{underscore}.

The \sty{babel} package defines the switch \cmd{if@safe@actives} and patches several standard commands such that the switch is set to \opt{true} while they process their arguments. The approach taken by the \sty{underscore} package is slightly different. If \sty{underscore} is loaded with the \opt{strings} option, it patches several commands such that \cmd{protect} is equivalent to \cmd{string} while the arguments are processed. If any one of these packages is loaded, \sty{csquotes} will take advantage of that automatically. Unfortunately, both packages patch a different set of commands and neither one covers all possibly vulnerable commands. If \sty{babel} is loaded, for example, you may use active quotes in the argument of \cmd{label}, but not in the argument of \cmd{input}. If you load \sty{underscore} with its \opt{strings} option, active quotes may also be used in the argument of \cmd{input}.

When writing a package which may have to process user"=supplied arguments in a strings-only context, there are two ways to deal with active quotes. Taking the approach of the \sty{babel} package, you may do the following:

\begin{ltxcode}
\let\if@safe@actives\iftrue
\end{ltxcode}
%
This is best done in a group. If grouping is not feasible, you must ensure that the switch is properly restored. In contrast to using \cmd{@safe@activestrue}, this approach works even if \sty{babel} is not loaded. However, note that you must take three states into account when restoring the switch in this case: true, false, and undefined. Taking the approach of the \sty{underscore} package, you may also do the following:

\begin{ltxcode}
\let\@@protect\protect
\let\protect\string
\end{ltxcode}
%
This could either be done in a group or without any grouping, but followed by \cmd{restore@protect}. The first approach works with the active characters of the \sty{babel} and the \sty{underscore} packages. The second one works with the \sty{underscore} and the \sty{at} packages. Unfortunately, the active characters of the \sty{inputenc} package support neither of the above"=mentioned techniques. As far as \sty{csquotes} is concerned, it does not matter which approach you take. In both cases all active quotes expand to themselves with category code 12. \acr{UTF-8} encoded active quotes expand to a string of characters with category code 12. This string will be valid \acr{UTF-8}. In a verbatim \cmd{write} operation, you should employ one of the techniques discussed in this section rather than \cmd{@verbatimquotes}, which is geared to verbatim typesetting.

\subsection{Block quotations}
\label{aut:blk}

The block quotation facilities need to typeset all quotations twice. The first pass is required to measure the length of the quotation. The actual typesetting takes place on the second pass, in a format depending on the result of the first one. In order to prevent any side"=effects of the first (trial) pass, the \sty{csquotes} package (1) performs the first pass inside a group, (2) employs checkpointing to freeze all LaTeX counters, and (3) sets \cmd{if@filesw} to \texttt{false}. However, it can not prevent side"=effects caused by commands that (1) make any global assignments which are not overwritten on the second pass (for example, by way of \cmd{g@addto@macro}), (2) increment counters globally in a way that circumvents \latex's counter commands, or (3) do not check \cmd{if@filesw} every time they are about to write to an auxiliary file. If you observe any malfunctions related to the trial pass (for example, if counters are incremented twice or if an item appears twice in a list), use \cmd{BlockquoteDisable} to redefine or disable the affected command temporarily.

\begin{ltxsyntax}

\cmditem{BlockquoteDisable}{code}

The \prm{code} may be arbitrary \latex code which redefines vulnerable commands locally such that they work differently during the trial pass. The \prm{code} itself should obviously not include any global assignments. This solution should be considered as a last ressort but may be the quickest way to fix a vulnerable package. Note that there is no need to escape parameter characters by doubling them in the \prm{code} argument. Simply use this command like \cmd{AtBeginDocument} and similar hooks.

\end{ltxsyntax}

\subsection{Registering quotation marks}
\label{aut:sfc}

In order to track punctuation marks inside quotations, this package requires that all quotation marks be transparent to the space factor, \ie that they have a space factor code of zero. This setting is specific to the output encoding. Settings for the encodings \acr{OT1}, \acr{OT2}, \acr{OT4}, \acr{T1}, \acr{LY1}, \acr{LGR}, \acr{T2A}, \acr{T2B}, \acr{T2C}, \acr{LCY}, \acr{X2}, and \acr{EU1} are provided by default. Other encodings may be set up in the configuration file using the following command:

\begin{ltxsyntax}
\cmditem{DeclareQuoteGlyph}{encoding}{position}
\end{ltxsyntax}

The \prm{encoding} is the name of the output encoding, for example \texttt{OT1}. This string corresponds to the identifiers used when loading the \sty{fontenc} package. The \prm{position} argument is an integer indicating the position of a glyph in this encoding. You need to reqister all quotation marks in the output encoding, using one declaration for each glyph. As an example, these are the settings for the \acr{OT1} encoding:

\begin{ltxcode}
\DeclareQuoteGlyph{OT1}{34}% = \textquotedblright
\DeclareQuoteGlyph{OT1}{39}% = \textquoteright
\DeclareQuoteGlyph{OT1}{92}% = \textquotedblleft
\DeclareQuoteGlyph{OT1}{96}% = \textquoteleft
\end{ltxcode}
%
The \prm{position} argument may use any notation accepted by \tex in integer assignments, \eg \texttt{171} in decimal or \verb+"00AB+ in hexadecimal notation. See the settings in \path{csquotes.def} for further examples. The advantage of registering quotes with the above command (rather than adjusting the space factor codes globally) is that the declarations are only used locally inside quotations and will not affect any other part of the document.

\subsection{Automatic quotation marks}
\label{aut:amk}

The commands in this section provide access to the automatic quotation facilities at a slightly lower level than the user commands in sections \ref{bas:reg} and \ref{act:reg}. In contrast to the commands discussed in section \ref{aut:imk}, the facilities in this section are fully"=fledged markup elements which verify the nesting level and issue an error if quotations are nested in an invalid way. They form groups and must always be balanced, see section \ref{hnt:grp} for details. In other words, the facilities in this section are semantic markup elements, the ones in section \ref{aut:imk} are physical markup elements.

\begin{ltxsyntax}

\csitem{openautoquote} Opens a nestable quotation.
\csitem{closeautoquote} Closes a nestable quotation.

\end{ltxsyntax}

In terms of their function, the above commands correspond to the regular versions of \cmd{enquote} and \cmd{MakeAutoQuote}. The following commands correspond to the starred variants \cmd{enquote*} and \cmd{MakeAutoQuote*}:

\begin{ltxsyntax}

\csitem{openinnerquote} Opens an inner quotation.
\csitem{closeinnerquote} Closes an inner quotation.

\end{ltxsyntax}

The above commands may be used to implement an alternative user interface. For example, you can combine them with the shorthands of the \sty{babel} package such that \sty{babel} provides the user interface and \sty{csquotes} the backend. See section \ref{hnt:bbl} and the \sty{babel} manual for details.

\subsection{Internal quotation marks}
\label{aut:imk}

The commands in this section print the quotation marks of the current style, as defined with \cmd{DeclareQuoteStyle}, without any grouping or nesting control. The quotation marks reflect all changes to the quotation style. If the multilingual interface is enabled, they are also synced with the current language.

\begin{ltxsyntax}

\csitem{textooquote} Prints the opening outer quotation mark of the currently active quote style.
\csitem{textcoquote} Prints the closing outer quotation mark.
\csitem{textmoquote} Prints the middle outer quotation mark.

\csitem{textoiquote} Prints the opening inner quotation mark.
\csitem{textciquote} Prints the closing inner quotation mark.
\csitem{textmiquote} Prints the middle inner quotation mark.

\end{ltxsyntax}

Note that the initialization hooks for the respective quotation style are not executed automatically. They may be accessed separately:

\begin{ltxsyntax}

\csitem{initoquote} Executes the outer initialization hook.
\csitem{initiquote} Executes the inner initialization hook.

\end{ltxsyntax}

The scope of these hooks must always be confined to a group.

\section{Revision history}

This revision history is a list of changes relevant to users of this package. Changes of a more technical nature which do not affect the user interface or the behavior of the package are not included in the list. If an entry in the revision history states that a feature has been \emph{extended}, this indicates a syntactically backwards compatible modification, such as the addition of an optional argument to an existing command. Entries stating that a feature has been \emph{modified} demand attention. They indicate a modification which may require changes to existing documents in some, hopefully rare, cases. The numbers on the right indicate the relevant section of this manual.

\begin{changelog}

\begin{release}{4.4d}{2010-02-06}
\item Added quote style for Dutch
\item Added quote style for Finnish
\item Added quote style for Greek
\item Added support for \acr{LGR} encoding
\end{release}

\begin{release}{4.4c}{2009-09-23}
\item Fixed incompatibility with \sty{inputenx} package
\end{release}

\begin{release}{4.4b}{2009-07-24}
\item Fixed bug in glyph declarations for \acr{EU1} encoding
\end{release}

\begin{release}{4.4a}{2009-07-04}
\item Added support for \acr{EU1} encoding
\item Added quote style for Brazilian
\item Added preliminary quote style for Portuguese
\end{release}

\begin{release}{4.4}{2009-05-30}
\item Added package option \opt{maxlevel}\see{opt}
\item Added special quote style \opt{debug}\see{hnt:pre}
\item Added \cmd{DeclareQuoteGlyph}\see{aut:sfc}
\item Added support for \acr{OT2} and \acr{OT4} encodings
\item Added support for \acr{T2A}, \acr{T2B}, \acr{T2C}, \acr{X2} encodings
\item Added support for \acr{LCY} encoding
\item Added quote style for Russian
\end{release}

\begin{release}{4.3}{2008-11-23}
\item Made package option \kvopt{babel}{tryonce} the default setting\see{opt}
\item Internal updates for \path{biblatex} package
\end{release}

\begin{release}{4.2}{2008-06-24}
\item Upgrade to \sty{etoolbox} 1.6
\end{release}

\begin{release}{4.1}{2008-04-11}
\item Fixed timing issue with active quotes introduced in 4.0
\end{release}

\begin{release}{4.0}{2008-03-02}
\item \etex now mandatory requirement\see{int:req}
\item New dependency on \sty{etoolbox} package\see{int:req}
\item Added package option \opt{spanish}\see{opt}
\item Added variant \opt{mexican} to style \opt{spanish}\see{opt}
\item Removed variant \opt{oldstyle} from \opt{english} style\see{opt}
\item Removed variant \opt{oldstyle} from \opt{french} style\see{opt}
\item Removed variant \opt{imprimerie} from \opt{french} style\see{opt}
\item Expanded documentation\see{hnt:bbl}
\item Added \cmd{openautoquote} and \cmd{closeautoquote}\see{aut:amk}
\item Added \cmd{openinnerquote} and \cmd{closeinnerquote}\see{aut:amk}
\item Moved predefined styles, variants, options to \path{csquotes.def}
\item Added more hints and examples to \path{csquotes.cfg}
\item Added extended \pdf bookmarks to this manual
\end{release}

\begin{release}{3.8}{2008-01-05}
\item Added variant \opt{guillemets*} to style \opt{swedish}\see{opt}
\item Added language alias \opt{australian}\see{cfg:als}
\item Added language alias \opt{newzealand}\see{cfg:als}
\item Internal improvements
\end{release}

\begin{release}{3.7}{2007-03-25}
\item Added package option \kvopt{babel}{try}\see{opt}
\item Added package option \kvopt{babel}{tryonce}\see{opt}
\item Added \cmd{MakeAutoQuote*}\see{act:reg}
\item Added \cmd{MakeForeignQuote*}\see{act:bbl}
\item Added \cmd{MakeHyphenQuote*}\see{act:bbl}
\item Added \cmd{mkpretextpunct}\see{cfg:aux}
\item Added \cmd{mkpreblockpunct}\see{cfg:aux}
\item Added \cmd{mkpredisppunct}\see{cfg:aux}
\item Dropped compatibility code for \cmd{blockcite} legacy command
\item Internal updates for \path{biblatex} package
\end{release}

\begin{release}{3.6}{2006-11-09}
\item Added \cmd{BlockquoteDisable}\see{aut:blk}
\item Fix for \sty{amsmath} package (active quotes in \env{split} and other environments)
\item Fix for \sty{endnotes} package (endnotes in block quotations)
\item Revised Spanish quote style
\end{release}

\begin{release}{3.5}{2006-08-24}
\item Exchanged definitions of French \opt{quotes} and \opt{quotes*} variants\see{hnt:pre}
\item Internal updates for \path{inputenc} 1.1\,b (2006-05-05)
\end{release}

\begin{release}{3.4}{2006-04-02}
\item Stricter validation of user"=defined active characters\see{hnt:val}
\item Author interface now documented in this manual\see{aut}
\item Added documentation of \cmd{@enablequotes}\see{aut:ctl}
\item Added documentation of \cmd{@disablequotes}\see{aut:ctl}
\item Added documentation of \cmd{@verbatimquotes}\see{aut:ctl}
\item Added documentation of \cmd{@deletequotes}\see{aut:ctl}
\item Added documentation concerning string handling \see{aut:str}
\item Added documentation of interface to internal marks\see{aut:imk}
\end{release}

\begin{release}{3.3}{2006-02-27}
\item Added support for \acr{UTF-8} encoded active quotes\see{hnt:inc}
\item Modified active quotes, category codes 7, 8 no longer valid\see{hnt:val}
\item Modified delimiters, category codes 3, 4, 7, 8 no longer valid\see{hnt:val}
\item Active quotes may now be defined in the document body\see{act:ctl}
\item Renamed \cmd{RestoreQuotes} to \cmd{EnableQuotes}\see{act:ctl}
\item Added \cmd{DeleteQuotes}\see{act:ctl}
\item Added \cmd{VerbatimQuotes}\see{act:ctl}
\item Added \cmd{ExecuteQuoteOptions}\see{cfg:exe}
\item Added package option \kvopt{babel}{once}\see{opt}
\item Added new style variant for French\see{hnt:pre}
\item Improved nesting control of active block quotes
\item Made active block quotes robust
\end{release}

\begin{release}{3.2}{2005-12-05}
\item Added quote style for Spanish
\item Fixed bug in \sty{hyperref} interface
\end{release}

\begin{release}{3.1}{2005-08-29}
\item Added \cmd{textquote}\see{bas:txt:reg}
\item Added \cmd{foreigntextquote}\see{bas:txt:bbl}
\item Added \cmd{hyphentextquote}\see{bas:txt:bbl}
\item Renamed \cmd{cquote} to \cmd{textcquote}\see{cit:txt:reg}
\item Renamed \cmd{foreigncquote} to \cmd{foreigntextcquote}\see{cit:txt:bbl}
\item Renamed \cmd{hyphencquote} to \cmd{hyphentextcquote}\see{cit:txt:bbl}
\item Extended \cmd{textcquote}\see{cit:txt:reg}
\item Extended \cmd{foreigntextcquote}\see{cit:txt:bbl}
\item Extended \cmd{hyphentextcquote}\see{cit:txt:bbl}
\item Modified environment \env{displayquote}\see{env:bas}
\item Modified environment \env{foreigndisplayquote}\see{env:bas}
\item Modified environment \env{hyphendisplayquote}\see{env:bas}
\item Extended environment \env{displaycquote}\see{env:int}
\item Extended environment \env{foreigndisplaycquote}\see{env:int}
\item Extended environment \env{hyphendisplaycquote}\see{env:int}
\item Added \cmd{mkmidtextpunct}\see{cfg:aux}
\item Added \cmd{mkfintextpunct}\see{cfg:aux}
\item Added \cmd{mkmiddisppunct}\see{cfg:aux}
\item Added \cmd{mkfindisppunct}\see{cfg:aux}
\item Added auxiliary environment \env{quotetext}\see{cfg:aux}
\item Added detection of paragraphs to all block quotation facilities\see{bas:blk:reg}
\item \cmd{ifquote...} now usable in \cmd{mkcitation} and \cmd{mkccitation}\see{cfg:tst}
\item Terminal punctuation now evaluated by all quotation facilities
\item Prevent undesirable ?{}` and !{}` ligatures in \acr{T1} encoding
\item Always adjust space factor codes of backend quotes
\end{release}

\begin{release}{3.0}{2005-07-14}
\item Extended \cmd{blockquote}\see{bas:blk:reg}
\item Extended \cmd{foreignblockquote}\see{bas:blk:bbl}
\item Extended \cmd{hyphenblockquote}\see{bas:blk:bbl}
\item Extended \cmd{setquotestyle}\see{bas:set}
\item Added \cmd{cquote}\see{cit:txt:reg}
\item Added \cmd{foreigncquote}\see{cit:txt:bbl}
\item Added \cmd{hyphencquote}\see{cit:txt:bbl}
\item Added \cmd{blockcquote}\see{cit:blk:reg}
\item Added \cmd{foreignblockcquote}\see{cit:blk:bbl}
\item Added \cmd{hyphenblockcquote}\see{cit:blk:bbl}
\item Added environment \env{displayquote}\see{env:bas}
\item Added environment \env{foreigndisplayquote}\see{env:bas}
\item Added environment \env{hyphendisplayquote}\see{env:bas}
\item Added environment \env{displaycquote}\see{env:int}
\item Added environment \env{foreigndisplaycquote}\see{env:int}
\item Added environment \env{hyphendisplaycquote}\see{env:int}
\item Modified \cmd{DeclarePlainStyle}\see{cfg:pdf}
\item Added \cmd{SetCiteCommand}\see{cfg:blk}
\item Renamed \cmd{blockcite} to \cmd{mkcitation}\see{cfg:aux}
\item Added \cmd{mkccitation}\see{cfg:aux}
\item Added \cmd{mkmidblockpunct}\see{cfg:aux}
\item Added \cmd{mkfinblockpunct}\see{cfg:aux}
\item Added \cmd{ifquotepunct}\see{cfg:tst}
\item Added \cmd{ifquoteterm}\see{cfg:tst}
\item Added \cmd{ifquoteperiod}\see{cfg:tst}
\item Added \cmd{ifquotecomma}\see{cfg:tst}
\item Added \cmd{ifquotesemicolon}\see{cfg:tst}
\item Added \cmd{ifquotecolon}\see{cfg:tst}
\item Added \cmd{ifquoteexclam}\see{cfg:tst}
\item Added \cmd{ifquotequestion}\see{cfg:tst}
\item Added \cmd{ifstringblank}\see{cfg:tst}
\item Added evaluation of terminal punctuation within block quotations
\item With \cmd{nonfrenchspacing}, adjust space factor codes of backend quotes
\item Improved nesting control when running under \etex
\end{release}

\begin{release}{2.8}{2005-05-11}
\item Added \cmd{DisableQuotes}\see{act:ctl}
\item Fixed bug causing kerning restoration to fail in some rare cases
\end{release}

\begin{release}{2.7}{2005-04-13}
\item Use the font's kerning pairs for adjoining quotes, if available\see{cfg:sty}
\item Renamed \cmd{setblockthreshold} to \cmd{SetBlockThreshold}\see{cfg:blk}
\item Renamed \cmd{setblockenvironment} to \cmd{SetBlockEnvironment}\see{cfg:blk}
\item Provided more useful default definition of \cmd{blockcite}\see{cfg:aux}
\item Improved handling of adjoining quotes with respect to line breaking
\item When restoring active quotes, restore catcodes of delimiters as well
\item Improved workaround for \cmd{uppercase} and some \sty{babel} languages
\item Issue error message on quote mismatch regardless of \opt{strict} option
\item Issue \sty{hyperref} warning with block quotation commands in \pdf strings
\item Fixed bug in \cmd{DeclareQuoteStyle} and \cmd{DeclareQuoteAlias}
\end{release}

\begin{release}{2.6}{2005-02-24}
\item Always reset quote style, even for inner quotations
\item Fixed bug preventing hyphenation in certain places
\end{release}

\begin{release}{2.5}{2004-12-04}
\item Added \cmd{MakeBlockQuote}\see{act:blk:reg}
\item Added \cmd{MakeForeignBlockQuote}\see{act:blk:bbl}
\item Added \cmd{MakeHyphenBlockQuote}\see{act:blk:bbl}
\item Added \cmd{ifblockquote}\see{cfg:tst}
\item Modified \cmd{blockquote}\see{bas:blk:reg}
\item Modified \cmd{foreignblockquote}\see{bas:blk:bbl}
\item Modified \cmd{hyphenblockquote}\see{bas:blk:bbl}
\item Changed default threshold for block quotations\see{cfg:blk}
\item Improved math mode compatibility\see{hnt:mod}
\item Improved verbatim compatibility\see{hnt:mod}
\item Improved backend and active character handling
\item Improved validation of user"=defined active characters
\item Fixed bug suppressing kerning after block quotations
\item Issue error message with nested block quotations
\end{release}

\begin{release}{2.4}{2004-11-01}
\item Prevent use of \cmd{RestoreQuotes} in preamble\see{act:ctl}
\item Fixed bug causing premature expansion of backend quote macros
\item Fixed bug suppressing kerning before closing quotes
\end{release}

\begin{release}{2.3}{2004-09-18}
\item Reduced default kerning between adjoining curved quotes
\item Fixed bug with \cmd{DeclareQuoteStyle} in preamble
\end{release}

\begin{release}{2.2}{2004-07-13}
\item Extended \cmd{DeclareQuoteStyle}\see{cfg:sty}
\item Added initialization hook for inner quotations\see{cfg:sty}
\item Added support for middle inner quotes\see{cfg:sty}
\item Rearranged French quote styles, removing two variants\see{hnt:pre}
\item Added new style variant for French\see{hnt:pre}
\item Fixed bug causing stacking of reset hook for footnotes
\item Fixed bug preventing hyphenation in certain places
\item Fixed kerning issue specific to \textsc{ec} fonts
\end{release}

\begin{release}{2.1}{2004-06-15}
\item Added auxiliary environment \env{quoteblock}\see{cfg:aux}
\item Added support for language reset in footnotes\see{hnt:ftn}
\item Disable active characters in \cmd{verb} and \env{verbatim}\see{hnt:mod}
\item Disable active characters in \cmd{index} and \cmd{glossary}\see{hnt:mod}
\item Added package option and style variants for Norwegian
\item Removed some uncertain quote styles and aliases
\item Rearranged quote styles and aliases
\end{release}

\begin{release}{2.0}{2004-06-04}
\item Added \cmd{blockquote}\see{bas:blk:reg}
\item Added \cmd{foreignblockquote}\see{bas:blk:bbl}
\item Added \cmd{hyphenblockquote}\see{bas:blk:bbl}
\item Added \cmd{setblockthreshold}\see{cfg:blk}
\item Added \cmd{setblockenvironment}\see{cfg:blk}
\item Added auxiliary command \cmd{blockcite}\see{cfg:aux}
\item Extended \cmd{DeclareQuoteStyle}\see{cfg:sty}
\item Added initialization hook for outer quotations\see{cfg:sty}
\item Added support for middle outer quotes\see{cfg:sty}
\item Added support for kerning between adjoining quotes\see{cfg:sty}
\item Disable active characters in math and display math mode\see{hnt:mod}
\item Revised and improved error recovery\see{opt}
\item Added package option \opt{strict}\see{opt}
\item Added package option and new style variants for French
\item Added package option and new style variant for Italian
\item Added new style variant for English
\end{release}

\begin{release}{1.7}{2004-05-14}
\item Added \cmd{setquotestyle}\see{bas:set}
\item Modified \cmd{DeclarePlainStyle}\see{cfg:pdf}
\item Improved quote handling in \pdf strings\see{hnt:pdf}
\item Amended default French quote style\see{hnt:pre}
\end{release}

\begin{release}{1.5}{2004-02-27}
\item Reset quote nesting level in footnotes within quotations\see{hnt:ftn}
\end{release}

\begin{release}{1.4}{2003-12-13}
\item Added \cmd{MakeForeignQuote}\see{act:bbl}
\item Added \cmd{MakeHyphenQuote}\see{act:bbl}
\item Added \cmd{RestoreQuotes}\see{act:ctl}
\item Improved \sty{hyperref} interface\see{hnt:pdf}
\end{release}

\begin{release}{1.0}{2003-09-14}
\item Initial public release
\end{release}

\end{changelog}

\end{document}