Просмотр исходного кода

* Added Tufte-LaTeX debug message macros (\TufteWarning, \TufteInfo, \TufteError, \TufteDebugInfo, etc.)

* Fixed hyperref hyperfootnotes warning.
* Made TL classes less verbose (unless you use the [debug] class option).


git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@127 516e2f36-ce3a-0410-bea4-1d4a03f5df72
master
Kevin M. Godby 16 лет назад
Родитель
Сommit
5208b22521
3 измененных файлов: 38 добавлений и 29 удалений
  1. +1
    -1
      tufte-book.cls
  2. +36
    -27
      tufte-common.def
  3. +1
    -1
      tufte-handout.cls

+ 1
- 1
tufte-book.cls Просмотреть файл

@@ -72,7 +72,7 @@


\IfFileExists{tufte-book-local.tex} \IfFileExists{tufte-book-local.tex}
{\input{tufte-book-local} {\input{tufte-book-local}
\ClassInfo{\@tufte@pkgname}{Loading tufte-book-local.tex}}
\TufteInfoNL{Loading tufte-book-local.tex}}
{} {}


%% %%


+ 36
- 27
tufte-common.def Просмотреть файл

@@ -12,6 +12,16 @@
% We use the `xifthen' package to handle our package option switches % We use the `xifthen' package to handle our package option switches
\RequirePackage{xifthen} \RequirePackage{xifthen}


%%
% Define some shortcut macros for error/warning/info logging.

\newcommand{\TufteWarning}[1]{\ClassWarning{\@tufte@pkgname}{#1}}
\newcommand{\TufteWarningNL}[1]{\ClassWarningNoLine{\@tufte@pkgname}{#1}}
\newcommand{\TufteInfo}[1]{\ClassInfo{\@tufte@pkgname}{#1}}
\newcommand{\TufteInfoNL}[1]{\ClassInfo{\@tufte@pkgname}{#1\@gobble}}
\newcommand{\tufteDebugInfo}[1]{\ifthenelse{\boolean{@tufte@debug}}{\TufteInfo{#1}}{}}
\newcommand{\TufteDebugInfoNL}[1]{\ifthenelse{\boolean{@tufte@debug}}{\TufteInfoNL{#1}}{}}
\newcommand{\TufteError}[2]{\ClassError{\@tufte@pkgname}{#1}{#2}}


%% %%
% `debug' option -- provides more information in the .log file for use in % `debug' option -- provides more information in the .log file for use in
@@ -65,7 +75,7 @@
\newboolean{@tufte@symmetric} \newboolean{@tufte@symmetric}
\DeclareOptionX[tufte]<common>{symmetric}{ \DeclareOptionX[tufte]<common>{symmetric}{
\setboolean{@tufte@symmetric}{true} \setboolean{@tufte@symmetric}{true}
\ClassInfo{\@tufte@pkgname}{The `symmetric' option implies `twoside'}
\TufteInfoNL{The `symmetric' option implies `twoside'}
\ExecuteOptionsX[tufte]<common>{twoside} \ExecuteOptionsX[tufte]<common>{twoside}
} }


@@ -75,7 +85,7 @@
\newboolean{@tufte@twoside} \newboolean{@tufte@twoside}
\DeclareOptionX[tufte]<common>{twoside}{% \DeclareOptionX[tufte]<common>{twoside}{%
\setboolean{@tufte@twoside}{true} \setboolean{@tufte@twoside}{true}
\ClassInfo{\@tufte@pkgname}{Passing the `twoside' option to the `\@tufte@class' class}
\TufteInfoNL{Passing the `twoside' option to the `\@tufte@class' class}
\PassOptionsToClass{twoside}{\@tufte@class} \PassOptionsToClass{twoside}{\@tufte@class}
} }


@@ -127,7 +137,7 @@
\renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi \fi
}{% }{%
\PackageWarningNoLine{\@tufte@pkgname}{Invalid option `#1' for sidenote key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\TufteWarningNL{Invalid option `#1' for sidenote key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
} }


@@ -145,7 +155,7 @@
\renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi \fi
}{% }{%
\PackageWarningNoLine{\@tufte@pkgname}{Invalid option `#1' for marginnote key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\TufteWarningNL{Invalid option `#1' for marginnote key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
} }


@@ -163,7 +173,7 @@
\renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi \fi
}{% }{%
\PackageWarningNoLine{\@tufte@pkgname}{Invalid option `#1' for caption key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\TufteWarningNL{Invalid option `#1' for caption key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
} }


@@ -181,7 +191,7 @@
\renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi \fi
}{% }{%
\PackageWarningNoLine{\@tufte@pkgname}{Invalid option `#1' for citation key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\TufteWarningNL{Invalid option `#1' for citation key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options \renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
} }


@@ -199,7 +209,7 @@
\ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options \ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options
\fi \fi
}{% }{%
\PackageWarningNoLine{\@tufte@pkgname}{Invalid option `#1' for marginals key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\TufteWarningNL{Invalid option `#1' for marginals key.\MessageBreak Must be one of: justified, raggedleft,\MessageBreak raggedright, raggedouter, auto}
\ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options \ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options
} }


@@ -207,7 +217,7 @@
%% %%
% Unsupported options % Unsupported options


\newcommand{\@tufte@unsupported@option}[1]{\ClassWarningNoLine{\@tufte@pkgname}{Option `#1' is not supported -- \MessageBreak ignoring option}\OptionNotUsed}
\newcommand{\@tufte@unsupported@option}[1]{\TufteWarningNL{Option `#1' is not supported -- \MessageBreak ignoring option}\OptionNotUsed}


\DeclareOptionX[tufte]<common>{10pt}{\@tufte@unsupported@option{\CurrentOption}} \DeclareOptionX[tufte]<common>{10pt}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{11pt}{\@tufte@unsupported@option{\CurrentOption}} \DeclareOptionX[tufte]<common>{11pt}{\@tufte@unsupported@option{\CurrentOption}}
@@ -228,14 +238,14 @@




\DeclareOptionX*{% \DeclareOptionX*{%
\ClassInfo{\@tufte@pkgname}{Passing \CurrentOption\space to the `\@tufte@class' class}%
\TufteInfoNL{Passing \CurrentOption\space to the `\@tufte@class' class.}%
\PassOptionsToClass{\CurrentOption}{\@tufte@class}% \PassOptionsToClass{\CurrentOption}{\@tufte@class}%
} }
\ProcessOptionsX*[tufte]<common>\relax \ProcessOptionsX*[tufte]<common>\relax


%% %%
% Load the appropriate base class % Load the appropriate base class
\ClassInfo{\@tufte@pkgname}{Loading the base class `\@tufte@class'}
\TufteInfoNL{Loading the base class `\@tufte@class'}
\LoadClass{\@tufte@class} \LoadClass{\@tufte@class}


%% %%
@@ -300,12 +310,11 @@


\ifthenelse{\boolean{@tufte@loadhyper}}{% \ifthenelse{\boolean{@tufte@loadhyper}}{%
\ifthenelse{\boolean{@tufte@xetex}} \ifthenelse{\boolean{@tufte@xetex}}
{\RequirePackage[xetex]{hyperref}}
{\RequirePackage{hyperref}}
{\RequirePackage[hyperfootnotes=false,xetex]{hyperref}}
{\RequirePackage[hyperfootnotes=false]{hyperref}}
\hypersetup{% \hypersetup{%
pdfborder = {0 0 0}, pdfborder = {0 0 0},
bookmarksdepth = section, bookmarksdepth = section,
hyperfootnotes = false,
citecolor = DarkGreen, citecolor = DarkGreen,
linkcolor = DarkBlue, linkcolor = DarkBlue,
pagecolor = DarkBlue, pagecolor = DarkBlue,
@@ -453,11 +462,11 @@


\newboolean{@tufte@changepage} \newboolean{@tufte@changepage}
\IfFileExists{changepage.sty}{% \IfFileExists{changepage.sty}{%
\ClassInfo{\@tufte@pkgname}{Found changepage.sty}
\TufteDebugInfoNL{Found changepage.sty}
\RequirePackage[strict]{changepage} \RequirePackage[strict]{changepage}
\setboolean{@tufte@changepage}{true} \setboolean{@tufte@changepage}{true}
}{% }{%
\ClassInfo{\@tufte@pkgname}{Found chngpage.sty}
\TufteDebugInfoNL{Found chngpage.sty}
\RequirePackage[strict]{chngpage} \RequirePackage[strict]{chngpage}
\setboolean{@tufte@changepage}{false} \setboolean{@tufte@changepage}{false}
} }
@@ -610,7 +619,7 @@
\sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em} \sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em}
\sodef\smallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em} \sodef\smallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em}
}{ }{
\ClassWarningNoLine{\@tufte@pkgname}{Couldn't locate `soul' package.}
\TufteWarningNL{Couldn't locate `soul' package}
}% soul not installed... giving up. }% soul not installed... giving up.
} }


@@ -620,12 +629,12 @@
% Otherwise fall back on the soul package. % Otherwise fall back on the soul package.


\ifthenelse{\boolean{@tufte@pdf}} \ifthenelse{\boolean{@tufte@pdf}}
{\ClassInfo{\@tufte@pkgname}{ifpdf = true}}
{\ClassInfo{\@tufte@pkgname}{ifpdf = false}}
{\TufteDebugInfoNL{ifpdf = true}}
{\TufteDebugInfoNL{ifpdf = false}}


\ifthenelse{\boolean{@tufte@xetex}} \ifthenelse{\boolean{@tufte@xetex}}
{\ClassInfo{\@tufte@pkgname}{ifxetex = true}}
{\ClassInfo{\@tufte@pkgname}{ifxetex = false}}
{\TufteDebugInfoNL{ifxetex = true}}
{\TufteDebugInfoNL{ifxetex = false}}


% Check pdfLaTeX version % Check pdfLaTeX version
\def\@tufte@pdftexversion{0} \def\@tufte@pdftexversion{0}
@@ -649,14 +658,14 @@
% pdfLaTeX version is too old or not using pdfLaTeX % pdfLaTeX version is too old or not using pdfLaTeX
\ifthenelse{\boolean{@tufte@xetex}} \ifthenelse{\boolean{@tufte@xetex}}
{% TODO use xetex letterspacing {% TODO use xetex letterspacing
\ClassInfo{\@tufte@pkgname}{XeTeX detected. Reverting to `soul' package for letterspacing.}
\TufteDebugInfoNL{XeTeX detected. \MessageBreak Reverting to `soul' package for letterspacing}
\@tufte@loadsoul} \@tufte@loadsoul}
{% use `soul' package for letterspacing {% use `soul' package for letterspacing
\ClassInfo{\@tufte@pkgname}{Old version of pdfTeX detected. Reverting to `soul' package for letterspacing.}
\TufteDebugInfoNL{Old version of pdfTeX detected. \MessageBreak Reverting to `soul' package for letterspacing}
\@tufte@loadsoul} \@tufte@loadsoul}
\else \else
\IfFileExists{letterspace.sty}{% \IfFileExists{letterspace.sty}{%
\ClassInfo{\@tufte@pkgname}{Modern version of pdfTeX detected. Using `letterspace' package.}
\TufteDebugInfoNL{Modern version of pdfTeX detected. \MessageBreak Using `letterspace' package}
\RequirePackage{letterspace} \RequirePackage{letterspace}
% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+ % Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
\renewcommand{\allcapsspacing}[1]{\textls[200]{##1}} \renewcommand{\allcapsspacing}[1]{\textls[200]{##1}}
@@ -664,7 +673,7 @@
\renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}} \renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}}
\renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}} \renewcommand{\smallcaps}[1]{\textsc{\MakeTextLowercase{##1}}}
}{% microtype failed, check for soul }{% microtype failed, check for soul
\ClassInfo{\@tufte@pkgname}{Modern version of pdfTeX detected, but `letterspace' package not installed. Reverting to `soul' package for letterspacing.}
\TufteDebugInfoNL{Modern version of pdfTeX detected, but `letterspace' \MessageBreak package not installed. \MessageBreak Reverting to `soul' package for letterspacing}
\@tufte@loadsoul \@tufte@loadsoul
} }
\fi} \fi}
@@ -1481,7 +1490,7 @@
% Subsubsection and following section headings shouldn't be used. % Subsubsection and following section headings shouldn't be used.
% See Bringhurst's _The Elements of Typography_, section 4.2.2. % See Bringhurst's _The Elements of Typography_, section 4.2.2.
\renewcommand\subsubsection{% \renewcommand\subsubsection{%
\ClassError{\@tufte@pkgname}{\noexpand\subsubsection is undefined by this class.%
\TufteError{\noexpand\subsubsection is undefined by this class.%
\MessageBreak See Robert Bringhurst's _The Elements of \MessageBreak See Robert Bringhurst's _The Elements of
\MessageBreak Typographic Style_, section 4.2.2. \MessageBreak Typographic Style_, section 4.2.2.
\MessageBreak \noexpand\subsubsection was used} \MessageBreak \noexpand\subsubsection was used}
@@ -1491,7 +1500,7 @@
} }


\renewcommand\subparagraph{% \renewcommand\subparagraph{%
\ClassError{\@tufte@pkgname}{\noexpand\subparagraph is undefined by this class.%
\TufteError{\noexpand\subparagraph is undefined by this class.%
\MessageBreak See Robert Bringhurst's _The Elements of \MessageBreak See Robert Bringhurst's _The Elements of
\MessageBreak Typographic Style_, section 4.2.2. \MessageBreak Typographic Style_, section 4.2.2.
\MessageBreak \noexpand\subparagraph was used} \MessageBreak \noexpand\subparagraph was used}
@@ -1662,7 +1671,7 @@


\IfFileExists{tufte-common-local.tex} \IfFileExists{tufte-common-local.tex}
{\input{tufte-common-local.tex}% {\input{tufte-common-local.tex}%
\ClassInfo{\@tufte@pkgname}{Loading tufte-common-local.tex}}
\TufteInfoNL{Loading tufte-common-local.tex}}
{} {}






+ 1
- 1
tufte-handout.cls Просмотреть файл

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


\IfFileExists{tufte-handout-local.tex} \IfFileExists{tufte-handout-local.tex}
{\input{tufte-handout-local} {\input{tufte-handout-local}
\ClassInfo{\@tufte@pkgname}{Loading tufte-handout-local.tex}}
\TufteInfoNL{Loading tufte-handout-local.tex}}
{} {}






Загрузка…
Отмена
Сохранить