home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / inputs / latex / contrib / other / ogonek.lha / ogonek / ogonek.sty < prev    next >
Text File  |  1994-08-18  |  7KB  |  248 lines

  1. % This is a beta version of ogonek package
  2. % by Janusz S.Bie\'n (JSBien@plearn.edu.pl)
  3. % and Dirk H\"ubel (Hubel@bull.mimuw.edu.pl).
  4. %
  5. % The work on it (and on the upgrade of PLHB.STY)
  6. % will be resumed in October 1994.
  7. % In particular, the package will be improved and simplified
  8. % by using \DeclareTextCommand.
  9. %
  10. % Not yet tested with LaMeX2e!
  11. %
  12. % Consult OGONEK.DOC for documentation.
  13.  
  14. \def\fileversion{v0.41}
  15. \def\filedate{94/08/08}
  16. \def\docdate {94/08/08}
  17.  
  18. \NeedsTeXFormat{LaTeX2e}
  19.  
  20. {\catcode`\#=0 #catcode`#\=12 #gdef#@k{\k}}
  21. \ProvidesPackage{ogonek}[\filedate\space\fileversion\space
  22.                      (JSB and DH) provides \@k\space macro for ogonek]
  23.  
  24. \immediate
  25.  \write\sixt@@n{Package: `ogonek'
  26.  \fileversion\space <\filedate>  (JSB and DH)}
  27. \immediate
  28.  \write\sixt@@n{English Documentation
  29.  \@spaces <\docdate>  (JSB and DH)}
  30.  
  31.  
  32. \DeclareOption{PL}{
  33. % we will accept only Polish letters
  34.   \def\@testogonekletter##1{%
  35.     \ifx a##1\else
  36.     \ifx A##1\else
  37.     \ifx e##1\else
  38.     \ifx E##1\else
  39.         \PackageWarning{ogonek}%
  40.         {In Polish ogonek is used only with a/A and e/E}\fi
  41.     \fi \fi \fi
  42.   }
  43. }
  44.  
  45. \DeclareOption{LT}{
  46. % we will accept only Lithuanian letters
  47.   \def\@testogonekletter##1{%
  48.     \ifx a##1\else
  49.     \ifx A##1\else
  50.     \ifx e##1\else
  51.     \ifx E##1\else
  52.     \ifx i##1\else
  53.     \ifx I##1\else
  54.     \ifx u##1\else
  55.     \ifx U##1\else
  56.         \PackageWarning{ogonek}%
  57.        {In Lithuanian ogonek is used only with a/A, e/E, i/I and u/U}\fi 
  58.     \fi \fi \fi \fi \fi \fi \fi
  59. % if there have been specified both options, that means PL and LT, 
  60. % all four letters will be allowed    
  61.     }
  62. }
  63.  
  64.  
  65. % The following text comes from:
  66. %
  67. % PLHB.STY
  68. %
  69. % This is a modification of Leszek Holenderski's PLFONTS.STY,
  70. % restituting the input conventions of my PL.STY,
  71. % i.e. "r means z with dot and "z means z accent
  72. %                                 (J. S. Bie"n, 89-10-17)
  73. % PLFONTS.STY is a ``Polish fonts'' substyle to be used, as an option,
  74. % with LaTeX's document styles. This version differs from the previous
  75. % style for Polish fonts (designed by Janusz Bie"n) in that it does not
  76. % need this huge number of parameters controlling different placement
  77. % of Polish diacritic signs in different font sizes. Moreover, the present
  78. % style does not require any modification to the LFONTS.TEX file, as has
  79. % been the case with the previous style.             (L. Holenderski IIUW)
  80. %
  81. % This is the ``macro'' version.
  82. %
  83. % This version is for CM 300dpi.
  84.  
  85. \dimendef\pl@left=0 \dimendef\pl@down=1 \dimendef\pl@right=2 \dimendef\pl@temp=3
  86.  
  87. % typeset `ogonek' box
  88. \def\sob#1#2#3#4#5{%parameters: letter and fractions hl,ho,vl,vo
  89. \setbox0\hbox{#1}\setbox1\hbox{$_\mathchar'454$}\setbox2\hbox{p}%
  90. \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  91. \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  92. \pl@left=\pl@right \advance\pl@left by\wd1
  93. \pl@temp=-\pl@down \advance\pl@temp by\dp2 \dp1=\pl@temp
  94. \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
  95.  
  96. % `ogonek' boxes (first horizontal then vertical; first letter then `ogonek')
  97. \def\aob{\sob a{.66}{.20}{0}{.90}}
  98. \def\Aob{\sob A{.80}{.50}{0}{.90}}
  99. \def\eob{\sob e{.50}{.35}{0}{.93}}
  100. \def\Eob{\sob E{.60}{.35}{0}{.90}}
  101. \def\iob{\sob i{.66}{.20}{0}{.90}}
  102. \def\Iob{\sob I{.80}{.50}{0}{.90}}
  103. \def\uob{\sob u{.66}{.20}{0}{.90}}
  104. \def\Uob{\sob U{.60}{.35}{0}{.90}}
  105.  
  106.  
  107. % some useful definitions
  108. \def\@corkencoding{T1}
  109. \def\@oldfontsencoding{OT1}
  110. \def\@plencoding{OT1P}
  111. \def\@plfourencoding{OT4}
  112. \def\@unknownencoding{U}
  113. \def\@gonekaccent #1{%
  114.         \setbox\z@\hbox {#1}\ifdim\ht\z@=1ex\accent12 #1%
  115.     \else {\ooalign{\unhbox\z@\crcr\hidewidth\char12\hidewidth}}\fi}
  116.  
  117. {%TeXbook p. 45
  118. % any catcode will do to input the characters
  119. \catcode`\^^a1=11
  120. \catcode`\^^81=11
  121. \catcode`\^^a6=11
  122. \catcode`\^^86=11
  123. \global\def\@corkogonek#1{%
  124.     \ifx a#1^^a1\else
  125.     \ifx A#1^^81\else
  126.     \ifx e#1^^a6\else
  127.     \ifx E#1^^86\else\@gonekaccent #1\fi 
  128.     \fi \fi \fi 
  129. }
  130. \global\def\@oldfontsogonek#1{%
  131.     \ifx a#1\aob\else
  132.     \ifx A#1\Aob\else
  133.     \ifx e#1\eob\else
  134.     \ifx E#1\Eob\else
  135.     \ifx i#1\iob\else
  136.     \ifx I#1\Iob\else
  137.     \ifx u#1\uob\else
  138.     \ifx U#1\Uob\else\sob #1{.50}{.35}{0}{.90}\fi 
  139.     \fi \fi \fi \fi \fi \fi \fi 
  140. }
  141. \global\def\@plogonek#1{%
  142.     \ifx a#1^^a1\else
  143.     \ifx A#1^^81\else
  144.     \ifx e#1^^a6\else
  145.     \ifx E#1^^86\else
  146.     \ifx i#1\iob\else
  147.     \ifx I#1\Iob\else
  148.     \ifx u#1\uob\else
  149.     \ifx U#1\Uob\else\sob #1{.50}{.35}{0}{.90}\fi 
  150.     \fi \fi \fi \fi \fi \fi \fi 
  151. }}
  152.  
  153. \def\@checkandtypeset#1{%
  154.   \ifx \@corkencoding     \f@encoding\@corkogonek{#1}\else
  155.   \ifx \@oldfontsencoding \f@encoding\@oldfontsogonek{#1}\else
  156.   \ifx \@plencoding       \f@encoding\@plogonek{#1}\else
  157.   \ifx \@plfourencoding   \f@encoding\@plogonek{#1}\else
  158.     \PackageWarning{ogonek}%
  159.         {Ogonek accent skipped,
  160.     because a not supported encoding was detected}#1\fi
  161.   \fi \fi \fi
  162. }
  163.  
  164.  
  165. \DeclareOption{T1}{
  166. % Cork encoding
  167.   \ifx \@corkencoding \f@encoding 
  168.   \else
  169.     \PackageWarningNoLine{ogonek}%
  170.     {T1 encoding specified but not active while loading OGONEK.STY \MessageBreak
  171.      Active encoding: \f@encoding, let's hope you knowwhat you're doing.}\fi
  172.   \def\@typesetogonekletter##1{\@corkogonek{##1}}
  173. }
  174.  
  175. \DeclareOption{OT1}{
  176. % old fonts
  177.   \@ifundefined{@typesetogonekletter}{
  178.     \ifx \@oldfontsencoding \f@encoding
  179.     \else
  180.       \PackageWarningNoLine{ogonek}%
  181.       {OT1 encoding specified but not active while loading OGONEK.STY! \MessageBreak
  182.        Active encoding: \f@encoding, let's hope you know what you're doing.}\fi
  183.     \def\@typesetogonekletter##1{\@oldfontsogonek{##1}}
  184.   }{\PackageWarningNoLine{ogonek}%
  185.    {You should specify only one encoding, not more! Option OT1 ignored.}%
  186. }}
  187.  
  188. \DeclareOption{OT1P}{
  189. % pl fonts
  190.   \@ifundefined{@typesetogonekletter}{
  191.     \ifx \@plencoding \f@encoding
  192.     \else
  193.       \PackageWarningNoLine{ogonek}%
  194.       {OT1P encoding specified but not active while loading OGONEK.STY! 
  195.       Active encoding: \f@encoding, let's hope you know what you're doing.}\fi
  196.     \def\@typesetogonekletter##1{\@plogonek{##1}}
  197.   }{\PackageWarning{ogonek}%
  198.     {You should specify only one encoding, not more! Option OT1P ignored.}%
  199. }}
  200.  
  201. \DeclareOption{OT4}{
  202. % pl fonts, the same as OT1P
  203.   \@ifundefined{@typesetogonekletter}{
  204.     \ifx \@plfourencoding \f@encoding
  205.     \else
  206.       \PackageWarning{ogonek}%
  207.       {OT4 encoding specified but not active while loading OGONEK.STY! \MessageBreak
  208.        Active encoding: \f@encoding, let's hope you know what you're doing.}\fi
  209.     \def\@typesetogonekletter##1{\@plogonek{##1}}
  210.   }{\PackageWarning{ogonek}%
  211.    {You should specify only one encoding, not more! Option OT4 ignored.}%
  212. }}
  213.  
  214. \DeclareOption{U}{
  215. % dynamic checking for active font encoding
  216.   \@ifundefined{@typesetogonekletter}{
  217.     \def\@typesetogonekletter##1{\@checkandtypeset{##1}}
  218.   }{\PackageWarning{ogonek}%
  219.    {You should specify only one encoding, not more! Option U ignored.}%
  220. }}
  221.  
  222.  
  223. \ProcessOptions
  224.  
  225.  
  226. % if no language was specified, then we accept all letters
  227. \@ifundefined{@testogonekletter}
  228.   {\def\@testogonekletter#1{}}{}
  229.  
  230. % if no encoding was specified,
  231. % then we detect the active encoding dynamicly
  232. \@ifundefined{@typesetogonekletter}{
  233. %  \PackageWarningNoLine{ogonek}%
  234. % message removed by JSB on 1994-08-08
  235. %  {Specify an encoding option if possible.}
  236. % typo corrected below by JSB on 1994-07-12
  237.   \def\@typesetogonekletter#1{\@checkandtypeset{#1}}
  238.   }{}
  239.  
  240.  
  241.  
  242. \def\k#1{\relax\leavevmode\@testogonekletter{#1}\@typesetogonekletter{#1}}
  243.  
  244. \endinput
  245. %% 
  246. %% End of file `ogonek.sty'.
  247. 
  248.