diff options
Diffstat (limited to 'Master/texmf-doc/source/czechslovak/texlive-cz/csquote.sty')
-rw-r--r-- | Master/texmf-doc/source/czechslovak/texlive-cz/csquote.sty | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/Master/texmf-doc/source/czechslovak/texlive-cz/csquote.sty b/Master/texmf-doc/source/czechslovak/texlive-cz/csquote.sty new file mode 100644 index 00000000000..3644143647b --- /dev/null +++ b/Master/texmf-doc/source/czechslovak/texlive-cz/csquote.sty @@ -0,0 +1,181 @@ +%%%%%%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% File: CSQUOTE.TEX/STY +% Version: 1.1 +% +% Authors: Hunter Goatley <goathunter@wkuvx1.bitnet> +% (parts from QUOTE.TEX/STY) +% Petr Sojka <sojka@ics.muni.cs> +% +% Warranty: +% +% Copyright (c) 1992 by Hunter Goatley, Petr Sojka +% Permission to copy all or part of this work is granted, provided +% that the copies are not made or distributed for resale, and that +% the copyright notice and this notice are retained. +% +% THIS WORK IS PROVIDED ON AN "AS IS" BASIS. THE AUTHOR PROVIDES NO +% WARRANTY WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK, +% INCLUDING WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS +% FOR ANY PARTICULAR PURPOSE. +% +% If you make any improvements, I'd like to hear about them. +% +% History: +% +% Oct 26, 92 - V1.0 first release +% Dec 14, 92 - V1.1 \uv added +% +% Abstract: +% +% This file defines the macros \csdoublequoteson and \csdoublequotesoff. +% These macros allows switching between standard and following behaviour: +% TeX replace the double-quote character (") with Czech +% left and right double-quotes. For example: +% +% "This is a test." ---> ,,This is a test.'' +% +% The double-quote character is still available via \dq. +% \" is still treated as the umlaut accent. +% +% This macro makes a couple of assumptions about the double-quotes: +% +% 1. Double-quotes are assumed to come in pairs. When replacing +% double-quotes, the macro alternates between ,, and ''. The only +% exception to this is noted in (2) below. +% 2. A double-quote at the beginning of a paragraph is always treated +% as ,,. This correctly handles the case where a quotation is +% continued into a second paragraph: +% +% "This is the first paragraph.\par +% "This is the second paragraph of the same quote." +% +% Normal TeX spacing after ,, and '' is maintained by saving and +% restoring the \spacefactor. +% +% Macros work both with plainTex and LaTeX. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% HOW IT WORKS: +% +% The double-quote character (") is made active by \csdoublequoteson. +% The " macro keeps track of left-quote/right-quote pairs and inserts +% the appropriate ,, and '' in its place. +% +% Each character has a \spacefactor associated with it, which specifies +% the amount of stretch or shrink that a space following the character +% can have. Most characters have a factor of 1000, but some punctuation +% marks have higher spacefactors, most notably the period, which has a +% \spacefactor of 3000. This means the space following a period can +% stretch up to 3 times more than the space after a regular character, +% accounting for the increased space at the end of sentences. +% +% The ,, and '' ligatures are assigned \spacefactor's of 0, so that the +% \spacefactor that is applied to the next character is the same as that +% of the character preceding the quotes. Because " has been redefined as +% a macro, any spaces following " are swallowed by TeX. It was necessary +% to have this macro re-insert any needed space so that the following +% cases worked correctly: +% +% "This is a test," she said. --> ,,This is a test,'' she said. +% "This is in a list"; etc. --> ,,This is in a list''; etc. +% +% Without the added space, the first example becomes: +% +% ,,This is a test,''she said. +% +% The solution was to save the current \spacefactor before inserting a +% right double-quote, then resetting the \spacefactor after the +% insertion. The net effect was that the " macro has a \spacefactor +% of 0, which matches the way TeX treats ,, and ''. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{% % Begin a group for which " is active +\catcode`\"=\active % Make " an active character +\catcode`\@=11 % Make @ an active character +% +% \csdoublequoteson +% +% This macro makes " an active character, resets the control sequence +% \dblqu@te to L (left), and defines \dq as a replacement for ". +% +\gdef\csdoublequoteson{% % \csdoublequoteson enables " + \gdef"{\czechquotes}% % Define " as \czechquotes + \global\catcode`\"=\active% % Make " an active character + \global\chardef\dq=`\"% % Double-quote char. via \dq + \global\let\dblqu@te=L% % Always start with a left double-quote + } % End of macro +% +% \bq, \eq +% +% These macros define default characters for czech left and right +% double quotes. Czech opening quote is created from two commas with +% kerning depending on fontdimen four parameter of current font. +% Better solution should be specially designed character with +% proper kernings; if you have such characters in fonts +% (e.g. in DC-fonts), use it instead. (e.g. define +% macros \bq and \eq e.g. \def\bq{\char"130 } +% in your document/style file-- not in csquote.sty!) +% Similar solution is used for czech right quote. +% +% \cs existence test, stolen from TeXbook exercise 7.7 +\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax }% +% +% another macro to be more efficient in time and space +\global\chardef\f@@r=4 +% +\ifundefined{bq}% +\gdef\bq{\kern-.25\fontdimen\f@@r\font,\kern-.8\fontdimen\f@@r\font,% + \kern-.35\fontdimen\f@@r\font}% +\fi +\ifundefined{eq}% +\gdef\eq{\kern-.35\fontdimen\f@@r\font`\kern-.8\fontdimen\f@@r\font`% + \kern-.25\fontdimen\f@@r\font} +\fi +% +% Macro \uv for other usage of \bq and \eq. +% +\ifundefined{uv}% + \gdef\uv#1{\bq #1\eq} +\fi +% +% Define the macro that will be executed whenever " is encountered. +% +\gdef\czechquotes{% + % If the double-quote is the first character in a new paragraph, + % make sure it becomes a left double-quote. This case can be + % detected by checking to see if TeX is currently in vertical mode. + % If so, the double-quote is at the beginning of the paragraph + % (since " hasn't actually generated any horizontal mode tokens + % yet, TeX is still in vertical mode). If the mode is vertical, + % set \dblqu@te equal to L. + % + \ifinner\else\ifvmode\let\dblqu@te=L\fi\fi% + % + % Now insert the appropriate left or right double-quote. + % + % If \dblqu@te is L, insert an opening quote and set \dblqu@te to R. + % + \if L\dblqu@te\bq\global\let\dblqu@te=R% + % + % Otherwise, save the current \spacefactor, insert '', set \dblqu@te + % to L, and reset the original \spacefactor. + % + \else% + \let\xxx=\spacefactor% % Save the \spacefactor + \eq% % Insert ending quote + \global\let\dblqu@te=L% % and reset \dblqu@te + \spacefactor\xxx% % Reset the \spacefactor + \fi% % End of \if L\dblqu@te... + } % End of " macro +} % End of group + +\gdef\csdoublequotesoff{% + \catcode`\"=12% % Set " back to other + } +% +% Czech quotes are default +% +\csdoublequoteson + |