From: olems@ulrik.uio.no (Ole Michael Selberg)
Newsgroups: comp.text.tex
Subject: Re: german quotation marks in TeX ?
Date: 20 Aug 92 11:21:05 GMT
Followup-To: comp.text.tex
Organization: Oslo University

In article <451@muller.loria.fr>, roegel@loria.fr (Roegel Denis) wrote:
> 
> Hi all,
> 
> This is a very easy question. I would like to typeset the german quotation
> marks, the first beeing left down, the last up and right. 
>  
> It looks something like         
>                            Hallo"
>                           "
> I could of course use " and lower it to get the left mark, but I wonder if
> this has already been defined, especialley by german TeXnicians. All what I 
> found was to use `` and '' within the Fraktur font defined by Haramboulis.
> Is there a better solution ?
> 

% You can obtain ,, with the following definition:

\def\anf{\leavevmode\setbox0=\hbox{\lower1.38ex\hbox{''}}\ht0=0pt % 
   \dp0=0pt \box0}

% You may want to do some additional kerning, since the 
% supposes `` to be an opening quote (Anfuehrungszeichen) and '' a closing
% quote (Abfuehrungszeichen), whereas in German it's the other way around.
% This makes the spacing slightly wrong (it's almost imperceptible,
though!).

% Personally, I think you'd get a better result using guillemets
% (i.e. >>Hallo<< instead of ,,Hallo```).
% These are the macros I've written myself to be able to combine
% PS guillmets, taken from Times, with Computer Modern Roman
% (\ti is TimesItalic, \tb -- TimesBold etc, which are supposed to be
defined 
% by \font in the usual way; \ab yields `<<', \as yields `>>', \hab yields
`<'
% /initial half quote/, \has yields `>' /final half quote/):
%%
%% Guillemet definitions:
%%
  \def\ab{\leavevmode\ifnum\fam=\itfam\abit\else%
       \ifnum\fam=\bffam\abbf\else\ifnum\fam=\slfam\absl\else%
               \abrm\fi\fi\fi}%
           \def\abit{{\ti\char171}\kern-0.1em}%  
           \def\absl{{\ts\lower0.05em\hbox{\char171}}}%
           \def\abbf{{\tb\char171}}%
           \def\abrm{{\tr\lower0.05em\hbox{\char171}}}%
  \def\as{\leavevmode\ifnum\fam=\itfam\asit\else%
       \ifnum\fam=\bffam\asbf\else\ifnum\fam=\slfam\assl\else%     
               \asrm\fi\fi\fi}%
           \def\asit{{\ti\char187}}%
           \def\assl{{\ts\lower0.05em\hbox{\char187}}}%  
           \def\asbf{{\tb\char187}}%
           \def\asrm{{\tr\lower0.05em\hbox{\char187}}}%
  \def\hab{\leavevmode\ifnum\fam=\itfam\habit\else%
       \ifnum\fam=\bffam\habbf\else\ifnum\fam=\slfam\habsl\else%
              \habrm\fi\fi\fi}%
           \def\habit{{\ti\char172}}%  
           \def\habsl{{\ts\char172}}%
           \def\habbf{{\tb\char172}}%
           \def\habrm{{\tr\char172}}%
   \def\has{\leavevmode\ifnum\fam=\itfam\hasit\else%
       \ifnum\fam=\bffam\hasbf\else\ifnum\fam=\slfam\hassl\else
              \hasrm\fi\fi\fi}
           \def\hasit{{\ti\char173}}%
           \def\hassl{{\ts\char173}}%  
           \def\hasbf{{\tb\char173}}%
           \def\hasrm{{\tr\char173}}%
		   
% To simplify my work, I make " and * active, so that I can
% input: 
%           Han sa: "Jeg har avbestilt *Aftenposten*." 
% and have it apprear like this in my output:
%           Han sa: <<Jeg har avbestilt <Aftenposten>.>>
% For this, I use the following macros:

%%
%% Definitions for simplified input of quotes:
%%
\newcount\quoteflag \newcount\quotecount 
\newcount\hquoteflag  \newcount\hquotecount
\def\star{*}
\catcode`\"=\active
\catcode`\*=\active
\def"{\ifnum\quoteflag=0 \ab\global\quoteflag=1
       \else\as\global\quoteflag=0 \fi \global\advance\quotecount by1}
\def*{\ifnum\hquotecount=0 \hab\global\hquoteflag=1
       \else\has\global\hquoteflag=0 \fi\global\advance\hquotecount by1}
\def\quotetest{\ifodd\quotecount\immediate\write16{!! Uneven number of
quotes.}\fi
     \ifodd\hquotecount\immediate\write16{!! Uneven number of half
quotes.}\fi}
	  
% The macro \quotetest can be used within other macros, e.g. chapter
macros,
% to alert you of non-matching quotes.

% NB: If you want to use the above definitions for German, you should let
% \ab and \hab exchange places with \as and \has, so that
%         "Ich verstehe nicht", sagte sie
% yields
%         >>Ich verstehe nicht<<, sagte sie
% according to the rules of German standard typography (except in
Switzerland).


Ole Michael Selberg
Institutt for oesteuropeiske og orientalske studier
Universitetet i Oslo
Postboks 1030 Blindern
N-0315 Oslo 3