From ba4262c3fe601767751b69f0b7c476064ba5d506 Mon Sep 17 00:00:00 2001 From: "Kevin M. Godby" Date: Mon, 25 Feb 2008 15:19:35 +0000 Subject: [PATCH] * Improved letterspacing using either the microtype or soul packages. The dependencies are optional -- if the packages aren't installed, you won't get improved letterspacing for small-caps and all-caps. git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@47 516e2f36-ce3a-0410-bea4-1d4a03f5df72 --- tufte-handout.cls | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tufte-handout.cls b/tufte-handout.cls index c8fd6be..45ee74b 100644 --- a/tufte-handout.cls +++ b/tufte-handout.cls @@ -134,11 +134,43 @@ \partopsep\plpartopsep \def\makelabel##1{\hss\llap{##1}}}} +%% +% Improved letterspacing of small caps and all-caps text. +% +% First, try to use the `microtype' package, if it's available. +% Failing that, try to use the `soul' package, if it's available. +% 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 + \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. +} + +\DeclareTextFontCommand{\textsmallcaps}{\scshape} +\renewcommand{\textsc}[1]{\textsmallcaps{\smallcapsspacing{#1}}} + + %% % An environment for paragraph-style section \providecommand\newthought[1]{\vspace{1.8\baselineskip plus 3pt minus 2pt}% - {\noindent\scshape #1}} + {\noindent\textsc{#1}}} %% % Transform existing \footnotes into \sidenotes