% Copyright 2005-2012 TeX Users Group.
% 
% Copying and distribution of this file, with or without modification,
% are permitted in any medium, without royalty.

\documentclass[11pt]{article}

% we have to change the font encoding for Lucida.
\usepackage[T1]{fontenc}
\usepackage{textcomp} % to get the right copyright, etc.

% use Lucida fonts for both text and math.
\usepackage[altbullet]{lucidabr}     % get larger bullet
\DeclareEncodingSubset{TS1}{hlh}{1}  % including \oldstylenums

% other features we'll use.
\usepackage{framed}
\reversemarginpar
\addtolength\marginparwidth{20pt}

\usepackage{ifpdf} % live url's if pdf.
\ifpdf
  \usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black,
              urlcolor=black]{hyperref}
\else
  \usepackage{url}
\fi

\newcommand*\pkg[1]{\textsf{#1}}
% define \code for url-like breaking of typewriter fragments.
\ifx\nolinkurl\undefined \def\code{\url}\else \def\code{\nolinkurl}\fi
\DeclareRobustCommand\cs[1]{\mbox{\texttt{\char`\\#1}}}

% avoid a lot of whitespace above the title, and put something in the header.
\usepackage{titling} \setlength{\droptitle}{-110pt}
\pagestyle{headings}

\newcommand\demotext{%
  For \textsterling 45, almost anything can
  be found floating in fields. 
%  !`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!
  --- ?`But aren't Kafka's Schlo\ss{} and
  \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the d\ae monic
  ph\oe nix's official r\^ole in fluffy \rlap{souffl\'es?}}

\newcommand*\demotextsc{\textsc{Sphinx of black quartz, judge my vow}.}

\newcommand*\demotextosf{\oldstylenums{0123456789}.}

\newcommand*\raggedmarginpar[1]{%
  \marginpar{\small \raggedright\hspace{0pt}#1}}

\newcommand*\demo[2]{%
   \par\leavevmode\raggedmarginpar{#1}%
   \begin{minipage}[t]{\linewidth}%
   \raggedright\normalfont#2\demotext
   \end{minipage}%
}

\newcommand*\demosc[2]{%
  \par\leavevmode\raggedmarginpar{#1}{\normalfont#2\demotext
  \newline\demotextsc\par}%
}
\newcommand*\demoscosf[2]{%
  \par\leavevmode\raggedmarginpar{#1}{\normalfont#2\demotext
  \newline\demotextsc\space\demotextosf\par}%
}
\newcommand*\demoosf[2]{%
  \par\leavevmode\raggedmarginpar{#1}{\normalfont#2\demotext
  \newline\space\demotextosf\par}%
}


\title{Using the Lucida Type 1 fonts with \LaTeX}
\author{\TeX\ Users Group\\[2pt]\url{http://tug.org/lucida}}
\begin{document}
\maketitle


\section{Introduction}

{\def\thefootnote{}
% article.cls uses 1.8em for the footnote indent.
\footnotetext{\kern-1.8em \textregistered\ Lucida is a trademark of
Bigelow \& Holmes Inc.\ registered in the U.S. Patent \& Trademark
Office and other jurisdictions.}
}

This document contains examples of the Lucida fonts in Type~1 format
available from TUG.  TUG also offers a (slightly different) set of
Lucida fonts in OpenType format.  For more information and an order form
for any of the fonts, please see \url{http://tug.org/lucida}.


\section{\LaTeX\ macro support for Lucida Type 1}

The Lucida support primarily consists of two packages: \pkg{lucidabr}
and \pkg{lucbmath}.  The former changes both running text and math to use
Lucida, whereas the latter only changes the math font setup, in case you
want to use a different text font with the Lucida math fonts.

Naturally, the packages are included in the TUG distribution you receive
when you order the fonts.  They are also available from CTAN, in the
directory
\url{http://mirror.ctan.org/macros/latex/contrib/psnfssx/lucidabr}.  If
you run the example below and it complains that \code{lucidabr.sty} is
not found, you must install the packages.

\subsection{Basic example}

The packages do \emph{not} support \LaTeX's (and \TeX's) default
encoding (OT1).  Supported text encodings are T1 and LY1, and the text
companion encoding TS1 is partially supported.  Thus, you must use the
\pkg{fontenc} package (part of standard \LaTeX) to switch from the
default encoding.  Here's a small example:

\begin{verbatim}
\documentclass{article}
\usepackage[T1]{fontenc} % or LY1
\usepackage{textcomp}    % unnecessary with LY1
\usepackage[altbullet]{lucidabr}
\begin{document}
Here's some text. And here's some math:
\[
  \phi(x)=\int_{-\infty}^{x} e^{-x^{2}/2}
\]
Euro, copyright, and bullet symbols are available:
\texteuro \textcopyright \textbullet.
\end{document}
\end{verbatim}
This results in the following output:
\begin{framed}
Here's some text. And here's some math:
\[
  \phi(x)=\int_{-\infty}^{x} e^{-x^{2}/2}
\]
Euro, copyright, and bullet symbols are available:
\texteuro \textcopyright \textbullet.
\end{framed}

\subsection{More details}

If the example runs ok, but produces no output, try refreshing the
``filename database'' (e.g., run \texttt{mktexlsr}).  Also, of course,
you must actually purchase the fonts!  (The metrics and support files
are on CTAN, but not the \texttt{.pfb} files containing the actual
outlines.)

When the T1 encoding is used, it's best to load the \pkg{textcomp}
package along with \pkg{lucidabr}, or some symbols, notably
\cs{textcopyright}, will be synthesized instead of coming from the
fonts.  We don't load \pkg{textcomp} automatically since loading such
fundamental packages behind the scenes can cause hard-to-debug trouble.

Furthermore, the default \cs{textbullet} is quite small; the more normal
one above is used when the \code{altbullet} option to the \pkg{lucidabr}
package is given.

\subsection{Old style figures}

Old style figures ($\oldstylenums{0123456789}$) are produced with the
\LaTeX\ command \verb|\oldstylenums{...}|.  They are provided in the
Lucida Bright fonts (not sans or typewriter), but unfortunately their
treatment is slightly complicated and depends on the encoding you use.

\def\descitem#1{\hbox to 21pt{\hfil#1}}
\begin{description}
\item[\descitem{T1}]
When using T1 + \pkg{textcomp}, you can get old style figures
automatically in math mode via the usual command \verb|\oldstylenums|,
e.g., \verb|$\oldstylenums{0123456789}$|.  To be able to also get them
in text, you must add this line:\\[2pt]
\verb|  \DeclareEncodingSubset{TS1}{hlh}{1}|\\[2pt]
to your preamble \emph{after} loading the \pkg{textcomp} package.

\item[\descitem{LY1}]
For LY1, old style figures are the ordinary numbers of the small caps
font; so, using \verb|\textsc| or \verb|\scshape| automatically yields
the old style figures.  This is in accordance with the long-established
typographical tradition.

While the command \verb|\oldstylenums| works automatically in math mode
as in the previous case, for it to work with ordinary text, and to get
the bold old style figures in bold text, its \LaTeX\ definition has to
be changed, by specifying the font the figures will come from.  So you
must include this code in your preamble:
\begin{verbatim}
\makeatletter
\def\oldstylenums#1{\begingroup
  \spaceskip\fontdimen\tw@\font
  \usefont{OML}{hlcm}{\f@series}{it}%
  \mathgroup\symletters #1%
  \endgroup}
\makeatother
\end{verbatim}
\end{description}

After making the appropriate changes, you can get old style figures as
desired:

\medskip
\begin{tabular}{ll}
\verb|\oldstylenums{0123456789}| & \oldstylenums{0123456789} \cr
\verb|\textit{\oldstylenums{0123456789}}|&\textit{\oldstylenums{0123456789}}\cr
\verb|\textbf{\oldstylenums{0123456789}}|&\textbf{\oldstylenums{0123456789}}\cr
\end{tabular}


\section{Font samples}

The Lucida Type~1 font set contains math fonts (shown in the
accompanying \texttt{lucida-amsmath} document), and the following text
fonts: 

The basic text family is Lucida Bright, with the usual four
variants---regular, italic, bold, and bold italic; small caps and
oldstyle figures are available in the upright shapes:

\begin{quote}
\demoscosf{LucidaBright}{}

\demo{LucidaBright-Italic}{\itshape}

\demo{LucidaBright-Oblique}{\slshape}

\demoscosf{LucidaBright-Demi}{\bfseries}

\demo{LucidaBright-DemiItalic}{\bfseries\itshape}
\end{quote}

\bigskip\noindent The monospaced \code{LucidaSans-Typewriter} family is
available in the same four variants (no small caps or oldstyle figures):
\begin{quote}
\demo{LucidaSans-Typewriter}{\ttfamily\raggedright}

\demo{LucidaSans-Typewriter Oblique}{\ttfamily\slshape\raggedright}

\demo{LucidaSans-Typewriter Bold}{\ttfamily\bfseries\raggedright}

\demo{LucidaSans-Typewriter BoldOblique}
     {\ttfamily\bfseries\slshape\raggedright}
\end{quote}

\bigskip\noindent The sans serif, \code{LucidaSans}, is again
available in the same four variants (also with no small caps or
oldstyle):
\begin{quote}
\demo{LucidaSans}{\sffamily}

\demo{LucidaSans-Italic}{\sffamily\itshape}

\demo{LucidaSans-Demi}{\sffamily\bfseries}

\demo{LucidaSans-DemiItalic}
     {\sffamily\bfseries\itshape}
\end{quote}

\bigskip\noindent LucidaSans also exists in an ultra bold version, which
you have to select manually with \verb|\fontseries{ub}\selectfont|.
\begin{quote}
\demo{LucidaSans-Bold}{\sffamily\fontseries{ub}\selectfont}

\demo{LucidaSans-BoldItalic}
     {\sffamily\itshape\fontseries{ub}\selectfont}
\end{quote}


\bigskip\noindent A second, seriffed, typewriter font is included as
well. By default the \pkg{lucidabr} package selects Lucida Sans
Typewriter for typewriter; you can change that by giving the option
\code{seriftt}:\\ \verb|\usepackage[seriftt]{lucidabr}|
\begin{quote}
\demo{Lucida Typewriter}{\fontfamily{hlct}\selectfont\raggedright}

\demo{Lucida Typewriter Oblique}
     {\fontfamily{hlct}\selectfont\slshape\raggedright}

\demo{Lucida Typewriter Bold}{\fontfamily{hlct}\selectfont\bfseries\raggedright}

\demo{Lucida Typewriter BoldOblique}
     {\fontfamily{hlct}\selectfont\slshape\bfseries\raggedright}
\end{quote}


\bigskip\noindent Lucida Fax is an alternative text font, heavier than
usual, available in the same four variants. By giving the option
\code{fax} to \pkg{lucidabr} this becomes the default roman font.  There
are no small caps or oldstyle figures for this font.
\begin{quote}
\demo{LucidaFax}{\fontfamily{hlx}\selectfont}

\demo{LucidaFax-Italic}
     {\fontfamily{hlx}\selectfont\itshape}

\demo{LucidaFax-Bold}{\fontfamily{hlx}\selectfont\bfseries}

\demo{LucidaFax-BoldItalic}
     {\fontfamily{hlx}\selectfont\itshape\bfseries}
\end{quote}

\bigskip\noindent The Lucida Casual variant exists in two versions only:
medium upright and medium italic. You can make it the default text
font by giving the option \code{casual} to \pkg{lucidabr}.
\begin{quote}
\demo{LucidaCasual}{\fontfamily{hlcn}\selectfont}

\demo{LucidaCasual-Italic}
     {\fontfamily{hlcn}\selectfont\itshape}
\end{quote}


\bigskip\noindent Finally, three more specialized fonts are included. If
you specify the \code{calligraphic} option for \pkg{lucidabr}, Lucida
Calligraphy will be the default italic font. A similar option
\code{handwriting} makes Lucida Handwriting the default italic font.
\begin{quote}
\demo{Lucida Calligraphy-Italic}
     {\fontfamily{hlce}\selectfont 0123456789. }

\demo{Lucida Handwriting-Italic}
     {\fontfamily{hlcw}\selectfont}

\demo{Lucida Blackletter}
     {\fontfamily{hlcf}\selectfont}
\end{quote}

The above are all the Lucida Type~1 fonts available with \TeX\ support.
There are no plans to extend the selection; work now is focused on the
Lucida OpenType fonts.

\section{Closing}

If you have questions or problems regarding installation or use, please
email \code{lucida@tug.org}; this is an open and publicly archived list
for Lucida discussion; you can subscribe on the web at
\url{http://lists.tug.org/lucida}.  On the other hand, questions or
problems related to ordering or licensing should go to
\code{lucida-admin@tug.org}.

Finally, the home page for Lucida and \TeX, with an order form for the
fonts, is \url{http://tug.org/lucida}.

\end{document}
