Browse Source

* Fixed letterspacing so that it is compatible with older versions of

pdfLaTeX and is semi-compatible with XeLaTeX.  (XeLaTeX should eventually
  use OTF typefaces that have their own letterspacing options embedded.)
* Removed savepos/zref calls in sample-handout.tex.  I accidentally left
  this in during one of my experiments.  They cause compilation to fail
  with XeLaTeX.


git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@59 516e2f36-ce3a-0410-bea4-1d4a03f5df72
master
Kevin M. Godby 17 years ago
parent
commit
86ae3a8103
3 changed files with 87 additions and 18 deletions
  1. BIN
      sample-handout.pdf
  2. +5
    -4
      sample-handout.tex
  3. +82
    -14
      tufte-handout.cls

BIN
sample-handout.pdf View File


+ 5
- 4
sample-handout.tex View File

@@ -30,7 +30,7 @@

\usepackage{multicol}

\usepackage[savepos]{zref}
%\usepackage[savepos]{zref}

\usepackage{lipsum}

@@ -151,7 +151,7 @@ environment and figure~\ref{fig:textfig} is an example of the normal
\caption{This graph shows $y = \sin x$ from about $x = [-10, 10]$.
\emph{Notice that this figure takes up the full page width.}}
\label{fig:fullfig}
\zsavepos{pos:fullfig}
%\zsavepos{pos:fullfig}
\end{figure*}

\begin{figure}
@@ -159,7 +159,7 @@ environment and figure~\ref{fig:textfig} is an example of the normal
\caption{Hilbert curves of various degrees $n$.
\emph{Notice that this figure only takes up the main textblock width.}}
\label{fig:textfig}
\zsavepos{pos:textfig}
%\zsavepos{pos:textfig}
\end{figure}

Table~\ref{tab:normaltab} shows table created with the \texttt{booktabs}
@@ -168,6 +168,7 @@ the table's data.

\begin{table}[ht]
\centering
\fontfamily{ppl}\selectfont
\begin{tabular}{ll}
\toprule
Margin & Length \\
@@ -181,7 +182,7 @@ the table's data.
\end{tabular}
\caption{Here are the dimensions of the various margins used in the Tufte-handout class.}
\label{tab:normaltab}
\zsavepos{pos:normaltab}
%\zsavepos{pos:normaltab}
\end{table}

\section{Full-width text blocks}


+ 82
- 14
tufte-handout.cls View File

@@ -107,6 +107,23 @@

\RequirePackage[strict]{chngpage}

%%
% Detect if we're using pdfLaTeX
\IfFileExists{ifpdf.sty}{%
\RequirePackage{ifpdf}
}{% assume we're not using pdfTex?
\newif\ifpdf\pdffalse
}

%%
% Detect if we're using XeLaTeX
\IfFileExists{ifxetex.sty}{%
\RequirePackage{ifxetex}
}{% not using xelatex
\newif\ifxetex\xetexfalse
}


% Compute length used for full-width displays

\newlength{\@tufteh@overhang}
@@ -181,26 +198,77 @@
% Failing that, well, I give up.

\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase
\newcommand{\allcaps}[1]{\MakeTextUppercase{#1}}
\newcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{#1}}}
\newcommand{\smallcapsspacing}[1]{#1}

\IfFileExists{microtype.sty}{%
\RequirePackage[final]{microtype}
% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}
\renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}}
\renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}}
}{% microtype failed, check for soul
\def\allcapsspacing{\relax}
\def\smallcapsspacing{\relax}
\newcommand{\allcaps}[1]{\MakeTextUppercase{\allcapsspacing{#1}}}
\newcommand{\smallcaps}[1]{\MakeTextLowercase{\textsc{#1}}}

\newcommand{\@tufteh@loadsoul}{%
\IfFileExists{soul.sty}{%
\RequirePackage{soul}
\sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em}
\sodef\smallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em}
\renewcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{##1}}}
\renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}}
}{}% neither microtype nor soul are installed... giving up.
}{
\PackageWarningNoLine{tufte-handout}{Couldn't locate `soul' package.}
}% soul not installed... giving up.
}

% If we're using pdfLaTeX v1.40+, use the letterspace package.
% If we're using pdfLaTex < v1.40, use the soul package.
% If we're using XeLaTeX, use XeLaTeX letterspacing options.
% Otherwise fall back on the soul package.

\ifpdf\PackageInfo{tufte-handout}{ifpdf = true}
\else\PackageInfo{tufte-handout}{ifpdf = false}
\fi

\ifxetex\PackageInfo{tufte-handout}{ifxetex = true}
\else\PackageInfo{tufte-handout}{ifxetex = false}
\fi



% Check pdfLaTeX version
\def\@tufteh@pdftexversion{0}
\ifx\normalpdftexversion\@undefined \else
\let\pdftexversion \normalpdftexversion
\let\pdftexrevision\normalpdftexrevision
\let\pdfoutput \normalpdfoutput
\fi
\ifx\pdftexversion\@undefined \else
\ifx\pdftexversion\relax \else
\def\@tufteh@pdftexversion{6}
\ifnum\pdftexversion < 140
\def\@tufteh@pdftexversion{5}
\fi
\fi
\fi

\ifnum\@tufteh@pdftexversion<6
% pdfLaTeX version is too old or not using pdfLaTeX
\ifxetex
% TODO use xetex letterspacing
\PackageInfo{tufte-handout}{XeTeX detected. Reverting to `soul' package for letterspacing.}
\@tufteh@loadsoul
\else
\PackageInfo{tufte-handout}{Old version of pdfTeX detected. Reverting to `soul' package for letterspacing.}
\@tufteh@loadsoul
\fi
\else
\IfFileExists{letterspace.sty}{%
\PackageInfo{tufte-handout}{Modern version of pdfTeX detected. Using `letterspace' package.}
\RequirePackage{letterspace}
% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}
\renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}}
\renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}}
}{% microtype failed, check for soul
\PackageInfo{tufte-handout}{Modern version of pdfTeX detected, but `letterspace' package not installed. Reverting to `soul' package for letterspacing.}
\@tufteh@loadsoul
}
\fi


\DeclareTextFontCommand{\textsmallcaps}{\scshape}
\renewcommand{\textsc}[1]{\textsmallcaps{\smallcapsspacing{#1}}}



Loading…
Cancel
Save