From 4344cc13da5e29aa813d815ff260fc8533759a31 Mon Sep 17 00:00:00 2001 From: "Kevin M. Godby" Date: Mon, 5 Apr 2010 02:44:14 +0000 Subject: [PATCH] * Changed the ``bidi'' option to load bidi at the end of the preamble. git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@164 516e2f36-ce3a-0410-bea4-1d4a03f5df72 --- tufte-common.def | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/tufte-common.def b/tufte-common.def index 9c95f19..8ea39e1 100644 --- a/tufte-common.def +++ b/tufte-common.def @@ -284,6 +284,11 @@ \setboolean{@tufte@xetex}{false} } +\ifthenelse{\boolean{@tufte@xetex}}{% + \RequirePackage{xltxtra}% xltxtra loads xunicode and fontspec; must be loaded before bidi +}{} + + %% % Globally sets the length @@ -786,11 +791,20 @@ \RequirePackage{setspace} +%% +% Color +\RequirePackage[usenames,dvipsnames,svgnames]{xcolor}% load before bidi + %% % Load the bidi package if instructed to do so. This package must be loaded % prior to our redefining the \footnote and \cite commands. -\ifthenelse{\boolean{@tufte@loadbidi}}{\RequirePackage{bidi}}{} +\ifthenelse{\boolean{@tufte@loadbidi}}{% + \AtBeginDocument{% + \RequirePackage{bidi} + \@tufte@pkghook@post@bidi% + }% +}{} %% @@ -956,7 +970,6 @@ \marginpar{% \hbox{}\vspace*{#1}% \def\baselinestretch {\setspace@singlespace}% - \ifthenelse{\boolean{@tufte@loadbidi}}{\if@rl@footnote\@rltrue\else\@rlfalse\fi}{}% \reset@font\footnotesize% \@tufte@margin@par% use parindent and parskip settings for marginal text \vspace*{-1\baselineskip}\noindent% @@ -971,6 +984,29 @@ }% }% +% Ensure this is run after the bidi package has been loaded +\def\@tufte@pkghook@post@bidi{}% +\g@addto@macro{\@tufte@pkghook@post@bidi}{% + \renewcommand\@footnotetext[2][0pt]{% + \marginpar{% + \hbox{}\vspace*{#1}% + \def\baselinestretch {\setspace@singlespace}% + \if@rl@footnote\@rltrue\else\@rlfalse\fi% + \reset@font\footnotesize% + \@tufte@margin@par% use parindent and parskip settings for marginal text + \vspace*{-1\baselineskip}\noindent% + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark% + }% + \color@begingroup% + \@makefntext{% + \ignorespaces#2% + }% + \color@endgroup% + }% + }% +}% + % % Define \sidenote command. Can handle \cite. @@ -1449,10 +1485,6 @@ -%% -% Color -\RequirePackage[usenames,dvipsnames,svgnames]{xcolor} - %% % Produces a full title page