summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/logical-markup-utils/onedash.sty
blob: d9ce40ca245a8276a1b1841d21347a7e011746ae (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
% Copyright (C) 2009 Michał Masłowski

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


\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{onedash}[2009/05/09 language-dependent dashes]

% Declare option #1 providing quotes consisting of #2 space, #3
% character and #4 space after it.
\newcommand{\onedash@declare}[4]{%
  \DeclareOption{#1}{%
    \def\onedash@makeit{%
      \newcommand{\dash}{#2#3#4}
      \newcommand{\pdash}{#3#4}}}}

\onedash@declare{american}{}{\textemdash}{\hskip0pt}
\onedash@declare{british}{~}{\textendash}{\ }
\onedash@declare{polish}{~}{\textendash}{\ }
\onedash@declare{polish-emdash}{~}{\textemdash}{\ }

\ExecuteOptions{american}\relax % The default.
\ProcessOptions\relax
\onedash@makeit

% Hyphen used in Polish.
\newcommand\hyph{\kern0pt\discretionary{-}{-}{-}\penalty10000\hskip0pt\relax}