Debian Codegraph @

texmf-dist/doc/latex/embrac/embrac_en.tex

raw
1 % arara: pdflatex: { interaction: nonstopmode }
2 % arara: biber
3 % arara: pdflatex: { interaction: nonstopmode }
4 % arara: pdflatex: { interaction: nonstopmode }
5 % --------------------------------------------------------------------------
6 % the EMBRAC package
7 %
8 % Upright Brackets in Emphasized Text
9 %
10 % --------------------------------------------------------------------------
11 % Clemens Niederberger
12 % Web: https://github.com/cgnieder/embrac/
13 % E-Mail: [email protected]
14 % --------------------------------------------------------------------------
15 % Copyright 2012--2021 Clemens Niederberger
16 %
17 % This work may be distributed and/or modified under the
18 % conditions of the LaTeX Project Public License, either version 1.3c
19 % of this license or (at your option) any later version.
20 % The latest version of this license is in
21 % http://www.latex-project.org/lppl.txt
22 % and version 1.3c or later is part of all distributions of LaTeX
23 % version 2008/05/04 or later.
24 %
25 % This work has the LPPL maintenance status `maintained'.
26 %
27 % The Current Maintainer of this work is Clemens Niederberger.
28 % --------------------------------------------------------------------------
29 \documentclass[load-preamble+]{cnltx-doc}
30 \usepackage[biblatex]{embrac}
31
32 \setcnltx{
33 package = embrac ,
34 authors = Clemens Niederberger ,
35 email = [email protected] ,
36 url = https://github.com/cgnieder/embrac/ ,
37 quote-author-format = ,
38 add-cmds = {
39 AddEmph,
40 ChangeEmph,
41 DeleteEmph,
42 emb,embbracket,embparen,
43 EmbracMakeKnown,
44 EmbracOff,
45 EmbracOn,
46 printbibliography,
47 RenewEmph
48 }
49 }
50
51 \usepackage{csquotes}
52 \addbibresource{\jobname.bib}
53 \usepackage{filecontents}
54 \begin{filecontents}{\jobname.bib}
55 @book{bringhurst04,
56 title = {The Elements of Typographic Style},
57 author = {Robert Bringhurst},
58 year = {2004},
59 version = {3.2},
60 isbn = {978-0-88179-205-5},
61 publisher = {Hartley \&\ Marks, Canada}
62 }
63 @article{dtk12-dw,
64 author = {Dominik Waßenhoven},
65 title = {Aufrechte Klammern in kursivem Text},
66 journal = {Die \TeX{}nische Komödie},
67 volume = {2},
68 year = {2012},
69 pages = {51--53}
70 }
71 @online{lefloch11,
72 author = {Bruno Le Floch},
73 title = {Upright parentheses in italic text},
74 url = {http://tex.stackexchange.com/a/13057/5049},
75 date = {2011-03-09},
76 urldate = {2012-06-28}
77 }
78 \end{filecontents}
79
80 \usepackage{fixfoot}
81 \DeclareFixedFootnote\manythanks{Many thanks again for his kind permission to use it!}
82
83 \RenewEmph{[}[-0.045em,.02em]{]}[.055em,-.09em]
84 \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em]
85
86 \newnote*\added[2]{Version~#1: added #2}
87
88 \begin{document}
89
90 \section{License and Requirements}
91 \license
92
93 \embrac\ needs the the \bnd{l3kernel}~\cite{bnd:l3kernel} and
94 \bnd{l3packages}~\cite{bnd:l3packages}.
95
96 \section{Acknowledgements}
97 I like to thank both Dominik Waßenhoven for inspiration~\cite{dtk12-dw} and
98 Bruno Le Floch for providing code~\cite{lefloch11}. Without either of them this
99 package probably wouldn't exist.
100
101 \section{About}\label{sec:about}
102 \begin{cnltxquote}[{\cite[85]{bringhurst04}}]
103 Parentheses and brackets are not letters, and it makes little sense to speak
104 of them as roman or italic. There are vertical parentheses and sloped ones,
105 and the parentheses on italic fonts are almost always sloped, but vertical
106 parentheses are generally to be preferred. That means they must come from
107 the roman font, and may need extra spacing when used with italic
108 letterforms.
109
110 The sloped square brackets usually found on italic fonts are, if anything,
111 even less useful than sloped parentheses. If, perish the thought, there
112 were a book or film entitled \emph*{The View from My [sic] Bed}, sloped
113 brackets might be useful as a way of indicating that the brackets and their
114 contents are actually part of the title. Otherwise, vertical brackets
115 should be used, no matter whether the text is roman or italic:
116 \textquote{The View from My \emph{[sic]} Bed} and \textquote{\emph{the view
117 from my [sic] bed}.\kern.05em}
118 \end{cnltxquote}
119
120 Both this quote from~\citetitle{bringhurst04} by Robert Bringhurst and the
121 article \citetitle{dtk12-dw} by Dominik Waßenhoven~\cite{dtk12-dw} inspired
122 this package. Indeed, \embrac\ heavily borrows from the code
123 \citeauthor{dtk12-dw} provided in his article\manythanks. The code was
124 originally provided by Bruno Le~Floch\manythanks\ answering a question on
125 \href{http://tex.stackexchange.com}{TeX.sx}~\cite{lefloch11}.
126
127 \embrac\ tries to redefine \cs{emph}, \cs{textit} and
128 \cs{textsl}\added{0.6}{\cs{textsl}} in a way that neither parentheses nor
129 square brackets are sloped. In an ideal world you of course wouldn't need
130 this package because the italic font you're using would have vertical
131 parentheses and brackets by itself.
132
133 \begin{example}
134 \emph{This is emphasized [sic] text.} \par
135 \emph{This is emphasized text (as you can see).}
136 \end{example}
137
138 \section{How it Works}
139 The commands \cs{emph}, \cs{textit} and \cs{textsl} are redefined:
140 \begin{commands}
141 \command{emph}[\sarg\marg{emphasized text}]
142 Emphasizing text.
143 \command{textit}[\sarg\marg{text in italics}]
144 Italicizing text,
145 \command{textsl}[\sarg\marg{slanted text}]
146 Slanting text,
147 \command{textsi}[\sarg\marg{text in italic small caps}]
148 This command is only defined and thus redefined if you loaded
149 \pkg{fontspec}, \ie, if you're compiling your document with \XeLaTeX{} or
150 \LuaLaTeX.
151 \end{commands}
152 They now have a \sarg\ argument that restores the original behaviour.
153 Otherwise they're used just as before.
154
155 Let's see the example again:
156 \begin{example}
157 \emph{This is emphasized [sic] text.} \par
158 \emph{This is emphasized text (as you can see).}
159 \end{example}
160 As you can see you don't have to do anything apart from loading \embrac\ in
161 your preamble. Well -- that's actually not entirely true. You have to take
162 care of the kerning of the parentheses and brackets. Otherwise things could
163 look worse with \embrac\ than without.
164
165 The following example demonstrates one point why you have to be very careful
166 when using \embrac. Certain parenthesis-letter combinations might need
167 adjustments of the kerning:
168 \begin{example}
169 \emph{This is (just) emphasized text.} \par
170 \emph{This is (\kern.1em just) emphasized text.}
171 \end{example}
172 This of course strongly depends on the font you've chosen. Kerning is a very
173 important aspect when using this package and you shouldn't use it without
174 giving it a certain amount of attention. See the next section for more
175 details.
176
177 \section{Adding More Brackets \&\ Adjusting the Kerning}
178 If you want you can change the behaviour of \embrac. Maybe it should only
179 affect squared brackets? Or curly braces, too? This can be done with the
180 following commands. They all work locally which means if used inside a group
181 outside of it everything stays what it was.
182 \begin{commands}
183 \command{AddEmph}[\marg{o}\Oarg{\meta{io-kern},\meta{oo-kern}}%
184 \marg{c}\Oarg{\meta{ic-kern},\meta{oc-kern}}]
185 Add a pair of brackets to be left upright in italic text.
186 \command{ChangeEmph}[\marg{o}\Oarg{\meta{io-kern},\meta{oo-kern}}%
187 \marg{c}\Oarg{\meta{ic-kern},\meta{oc-kern}}]
188 Change the kerning values for a given pair of brackets.
189 \command{RenewEmph}[\marg{o}\Oarg{\meta{io-kern},\meta{oo-kern}}%
190 \marg{c}\Oarg{\meta{ic-kern},\meta{oc-kern}}]
191 Renew the kerning values for a given pair of brackets. See below for the
192 difference to \cs{ChangeEmph}.
193 \command{DeleteEmph}[\marg{o}\marg{c}]
194 Remove a pair of brackets from treatment.
195 \end{commands}
196 In the above descriptions \meta{o} means \emph{opening bracket} and \meta{c}
197 means \emph{closing bracket}. The kerning arguments are all four optional and
198 require -- if given -- to be a length. If they're not given \cs{AddEmph} and
199 \cs{RenewEmph} insert \code{0pt} and \cs{ChangeEmph} uses the value stored by
200 \cs{AddEmph} or \cs{RenewEmph} before.
201
202 \sinceversion{0.4}To each of these commands there are two variants that are
203 only semantically different\footnote{They're also using different lists
204 internally but you shouldn't concern yourself with this.}. They are all
205 called \cs*{\meta{base}OpEmph} or \cs*{\meta{base}ClEmph} where \meta{base} is
206 either \code{Add}, \code{Change}, \code{Renew} or \code{Delete}. Their
207 arguments are all the same: the half of what the main commands have for either
208 modifying the opening or the closing symbols.
209 \begin{commands}
210 \command{AddOpEmph}[\marg{o}\Oarg{\meta{io-kern},\meta{oo-kern}}]
211 An an opening bracket to the treatment.
212 \command{AddClEmph}[\marg{c}\Oarg{\meta{ic-kern},\meta{oc-kern}}]
213 An a closing bracket to the treatment.
214 \end{commands}
215 They allow you to add single symbols to \embrac's mechanism instead of adding
216 pairs.
217
218 In all these commands the optional argument \meta{io-kern} is inserted after
219 the opening bracket (inner opening), \meta{oo-kern} is inserted before it
220 (outer opening). \meta{ic-kern} is inserted before the closing bracket (inner
221 closing), \meta{oc-kern} after it (outer closing).
222
223 \embrac\ initially makes these definitions:
224 \begin{sourcecode}
225 % add some defaults:
226 \AddEmph{[}{]}[.04em,-.12em]
227 \AddEmph{(}[-.04em]{)}[,-.15em]
228 \end{sourcecode}
229
230 This document however uses ``Linux Libertine
231 O''\footnote{\url{http://www.linuxlibertine.org/}} both for the roman and the
232 italic font and redefines them in this way (still not sure these are the best
233 values):
234 \begin{sourcecode}
235 \RenewEmph{[}[-0.045em,.02em]{]}[.055em,-.09em]
236 \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em]
237 \end{sourcecode}
238
239 You can change them as you wish, but be careful with the kerning! What's too
240 less for one letter might be too much for others:
241 \begin{example}
242 \ChangeEmph{(}[.1em]{)}[.1em]
243 \emph{This is (just) emphasized text.} \par % looks OK, kind of
244 \emph{This is emphasized text (as you can see).} % looks bad
245 \end{example}
246
247 To see why it is important to pay attention to the kerning values let's look
248 at how \embrac's features look without kerning (\ie, \code{0pt} for each
249 value), with the default settings and with the settings for this document:
250
251 \begin{center}
252 \begin{minipage}{.5\linewidth}
253 \textbf{No Kerning:}
254
255 \RenewEmph{[}{]}\RenewEmph{(}{)}
256 \emph{This is emphasized [sic] text.} \\
257 \emph{This is emphasized text [as you can see].} \\
258 \emph{This is emphasized (sic) text.} \\
259 \emph{This is emphasized text (as you can see).}
260 \end{minipage}\bigskip
261
262 \begin{minipage}{.5\linewidth}
263 \textbf{\embrac's Default Kerning:}
264
265 \RenewEmph{[}{]}[.04em,-.12em]\RenewEmph{(}[-.04em]{)}[,-.15em]
266 \emph{This is emphasized [sic] text.} \\
267 \emph{This is emphasized text [as you can see].} \\
268 \emph{This is emphasized (sic) text.} \\
269 \emph{This is emphasized text (as you can see).}
270 \end{minipage}\bigskip
271
272 \begin{minipage}{.5\linewidth}
273 \textbf{Adjusted Kerning:}
274
275 \emph{This is emphasized [sic] text.} \\
276 \emph{This is emphasized text [as you can see].} \\
277 \emph{This is emphasized (sic) text.} \\
278 \emph{This is emphasized text (as you can see).}
279 \end{minipage}
280 \end{center}
281
282 Deleting a pair removes it completely from \embrac's mechanism. All
283 information about the pair and its kerning values will be lost. So if you
284 want the effects to be temporary use grouping.
285 \begin{example}
286 \DeleteEmph{[}{]}
287 \emph{This is emphasized [sic] text.} \par
288 \emph{This is emphasized text (as you can see).}
289 \end{example}
290
291 By the way: this packages provides a simple file
292 \code{embrac\_kerning\_test.tex} for testing kerning values. You should find
293 it in the same directory as this documentation.
294
295 \section{Adding More Commands}
296 If\sinceversion{0.9} you like to add additional macros to \embrac's treatment
297 (in addition to the already known \cs*{emph}, \cs*{textit}, \cs*{textsl}, and
298 \cs*{textsi}) then you can use the following command
299 \begin{commands}
300 \command{EmbracMakeKnown}[\marg{command}]
301 Redefine the command \meta{command} to replace brackets and parentheses by
302 upright ones. \meta{command} is the name of the command \emph{without} the
303 leading backslash!
304 \end{commands}
305 \embrac\ does this:
306 \begin{sourcecode}
307 \EmbracMakeKnown{emph}
308 \EmbracMakeKnown{textit}
309 \EmbracMakeKnown{textsl}
310 \end{sourcecode}
311
312 \section{biblatex Compatibility}
313 This is \embrac's only package option:
314 \begin{options}
315 \keychoice{biblatex}{\default{true},on,parens,false,off,none}\Default{false}
316 If set to \code{true} (or one of its aliases) parentheses and squared
317 brackets as defined by \pkg{biblatex} with \cs{bibleftparen},
318 \cs{bibrightparen}, \cs{bibleftbracket} and \cs{bibrightbracket} are
319 treated the same way (if not removed from the treatment with \cs{DeleteEmph}).
320
321 The command \cs*{blx@imc@mkbibemph} is patched to use the original definition
322 of \cs{emph}.
323 \end{options}
324
325 \begin{example}
326 % this document uses \usepackage[biblatex]{embrac}
327 \emph{Let's cite Bringhurst again:~\cite{bringhurst04}}.
328 \end{example}
329
330 \section{Turn \embrac\ Temporarily Off}
331 Redefining \cs{emph}, \cs{textit} and \cs{textsl} is not without danger.
332 Sometimes you might find that you'd want to keep the original definition for a
333 small portion of your document. You can use the following commands whose
334 functions are obvious, I guess:
335 \begin{commands}
336 \command{EmbracOff}
337 Turn \embrac's treatment off.
338 \command{EmbracOn}
339 Turn \embrac's treatment on.
340 \end{commands}
341 Both commands are local.
342
343 \section{Watch out!}
344 Please be aware that \embrac\ does not affect \cs{itshape} nor \cs{em} (nor
345 \cs{it} which you shouldn't use in a \LaTeX{} document, anyway).
346 \begin{example}
347 \itshape This is italic [sic] text.
348 \end{example}
349 In cases like this one of the following commands could be used:
350 \begin{commands}
351 \command{emb}[\marg{op}\marg{cl}\marg{text}]
352 Encloses\sinceversion{0.8} \meta{text} with \meta{op} and \meta{cl}. Both
353 \meta{op} and \meta{cl} must be brackets known to \embrac.
354 \command{embparen}[\marg{text}]
355 Encloses\sinceversion{0.8} \meta{text} with upright parentheses. This is
356 the same as \cs{emb}\Marg{(}\Marg{)}\marg{text}.
357 \command{embbracket}[\marg{text}]
358 Encloses\sinceversion{0.8} \meta{text} with upright brackets. This is
359 the same as \cs{emb}\Marg{[}\Marg{]}\marg{text}.
360 \end{commands}
361 \begin{example}
362 \itshape This is italic \embbracket{sic} text.
363 \end{example}
364
365 \section{Version History}
366 \begin{description}
367 \item[v0.1a] The command \cs{RenewEmph} has been renamed into
368 \cs{ChangeEmph} and a new slightly different \cs{RenewEmph} has been added.
369 \item[v0.2] Improved interaction with \pkg{biblatex}.
370 \item[v0.3] Added support for \pkg*{fontspec}'s \cs{textsi}.
371 \item[v0.5] Don't replace brackets in math mode.
372 \item[v0.6] Added support for \cs{textsl}.
373 \item[v0.7] Added support for symbols with a catcode other than~12.
374 \item[v0.8] Added \cs{embparen}, \cs{embbracket} and \cs{emb}.
375 \item[v0.9] Added \cs{EmbracMakeKnown}
376 \end{description}
377
378 \end{document}