~ubuntu-branches/ubuntu/edgy/tipa/edgy

« back to all changes in this revision

Viewing changes to sty/tone.sty

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2003-12-11 10:50:58 UTC
  • Revision ID: james.westby@ubuntu.com-20031211105058-vq8ttydhah3hdzq1
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
% tone.sty -- TIPA optional package for displaying `tone letters'.
 
2
% Copyright 2002 FUKUI Rei
 
3
%
 
4
% This program may be distributed and/or modified under the
 
5
% conditions of the LaTeX Project Public License, either version 1.2
 
6
% of this license or (at your option) any later version.
 
7
% The latest version of this license is in
 
8
%   http://www.latex-project.org/lppl.txt
 
9
% and version 1.2 or later is part of all distributions of LaTeX 
 
10
% version 1999/12/01 or later.
 
11
%
 
12
% This program consists of all files listed in Manifest.txt.
 
13
%
 
14
%  1996/06/10 first version.
 
15
%  2001/11/07 \stone (for a short tone bar) added.
 
16
%  2001/12/32 \@tonestembar added (due to encoding change;
 
17
%             \char'277 is now exclusively used for tone letter stem.
 
18
%
 
19
\RequirePackage{tipa}[2001/12/31 TIPA version 1.1]
 
20
 
 
21
\newif\if@longtone
 
22
\newdimen\@tonebarhtunit
 
23
\newdimen\@tonebarhalfwd
 
24
 
 
25
\newcommand\@tonestembar{\tipaencoding\char'277}
 
26
 
 
27
\newcommand\tone[1]{\@inittone\leavevmode
 
28
  \hbox{\kern\@sidegap\@tone#1\relax\kern-\@tonebarhalfwd{\@tonestembar}}}
 
29
 
 
30
\newcommand\rtone[1]{\@inittone\leavevmode
 
31
  \hbox{{\@tonestembar}\kern-\@tonebarhalfwd\@tone#1\relax\kern\@sidegap}}
 
32
 
 
33
\newcommand\stone[1]{\@inittone\@longtonefalse\leavevmode
 
34
  \hbox{\kern\@sidegap\@tone#1\relax\kern-\@tonebarhalfwd{\@tonestembar}}}
 
35
 
 
36
\newcommand\@tone[1]{%
 
37
  \ifx#1\relax
 
38
    \ifx\pr@vpr@vtone\relax \@outputtone\pr@vtone\pr@vtone
 
39
    \else \@outputtone\pr@vpr@vtone\pr@vtone\fi
 
40
    \let\next\relax
 
41
  \else
 
42
    \ifx\pr@vpr@vtone\relax\else
 
43
      \@longtonefalse\@outputtone\pr@vpr@vtone\pr@vtone\fi
 
44
    \let\pr@vpr@vtone\pr@vtone\def\pr@vtone{#1}%
 
45
    \let\next\@tone \fi
 
46
  \next}
 
47
 
 
48
\newcommand\@outputtone[2]{{%
 
49
  \count\z@ #1\advance\count\z@ -#2\def\@mintone{#2}%
 
50
  \ifnum\count\z@>0\count\@ne128\advance\count\@ne \count\z@
 
51
    \edef\@tonecode{\the\count\@ne}% falling tone
 
52
  \else
 
53
    \ifnum\count\z@<0\count\@ne132\advance\count\@ne -\count\z@
 
54
      \edef\@tonecode{\the\count\@ne}\def\@mintone{#1}% rising tone
 
55
    \else
 
56
      \def\@tonecode{128}\fi\fi % level tone
 
57
  \if@longtone\else\count\z@\@tonecode
 
58
    \advance\count\z@ 9 \def\@tonecode{\the\count\z@}\fi
 
59
  \@longtonefalse
 
60
  \count\@ne\@mintone \advance\count\@ne \m@ne
 
61
  \dimen\z@\the\count\@ne\@tonebarhtunit
 
62
  \raise\dimen\z@\hbox{%
 
63
    \@accshift{-\dimen\z@}%
 
64
    {\tipaencoding\char\@tonecode}%
 
65
    \@accshift{\dimen\z@}}}}
 
66
 
 
67
\newcommand\@toneshift[1]{\dimen\@ne#1}
 
68
 
 
69
\newcommand\@inittone{%
 
70
  \@getaccshift \let\c@lcshift\@toneshift
 
71
  \let\pr@vtone\relax\let\pr@vpr@vtone\relax
 
72
  \@longtonetrue{\setbox\z@\hbox{\@tonestembar}%
 
73
  \global\@tonebarhtunit.25\ht\z@
 
74
  \global\@tonebarhalfwd.5\wd\z@}}
 
75
 
 
76
\endinput