summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shipunov/qqru-shipunov.sty
blob: 5697764dce3fb9d684ad669de65a937c8f1006d1 (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
% Author: Alexey B. Shipunov (dactylorhiza@gmail.com)
% Companion Perl script: txt2qq.pl

\ProvidesPackage{qqru}%
        [2019/10/04 v0.32 Universal quotes for Russian and English]

\newif\if@QQRU
\DeclareOption{ru}{\@QQRUtrue}
\DeclareOption{en}{\@QQRUfalse}
\newif\if@CONVERT
\DeclareOption{convert}{\@CONVERTtrue}
\DeclareOption{noconvert}{\@CONVERTfalse}

\ExecuteOptions{ru,nconvert}
\ProcessOptions

\if@QQRU

 \def\<{<<}
 \def\>{>>}

\else

 \def\<{``}
 \def\>{''}

\fi

\if@CONVERT

{%
\catcode`\"=\active
\catcode`\@=11
\gdef\beginconvertquotes{%
 \global\catcode`\"=\active
 \global\chardef\dq=`\"
 \global\let\dblqu@te=L
 }
\gdef"{%
 \ifinner\else\ifvmode\let\dblqu@te=L\fi\fi
 \if L\dblqu@te\<\global\let\dblqu@te=R%
 \else
  \let\xxx=\spacefactor
  \>\global\let\dblqu@te=L%
  \spacefactor\xxx
 \fi
 }
}

\gdef\endconvertquotes{%
 \catcode`\"=12
 }

\AtBeginDocument{\beginconvertquotes}

\else\fi