diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty b/Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty index c4e8097964e..ae123fabef2 100644 --- a/Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty +++ b/Master/texmf-dist/tex/xelatex/bidi/bidituftesidenote.sty @@ -17,7 +17,7 @@ %% by Vafa Khalighi. %% %% -%% \CheckSum{42939} +%% \CheckSum{43075} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -35,7 +35,7 @@ %% Right brace \} Tilde \~} %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{bidituftesidenote}[2011/06/17 v0.1 +\ProvidesPackage{bidituftesidenote}[2014/12/28 v0.2 bidi implementation of tufte sidenote] \RequirePackage{xifthen} \RequirePackage{ragged2e} @@ -177,9 +177,11 @@ bidi implementation of tufte sidenote] \newcommand*{\@bidituftesidenote@sidenote@font}{\@bidituftesidenote@marginfont} \newcommand*{\@bidituftesidenote@marginnote@font}{\@bidituftesidenote@marginfont} \newcommand*{\@bidituftesidenote@citation@font}{\@bidituftesidenote@marginfont} +\newcommand*{\@biditufteLTRsidenote@citation@font}{\@bidituftesidenote@marginfont} \newcommand*{\setsidenotefont}[1]{\renewcommand*{\@bidituftesidenote@sidenote@font}{#1}} \newcommand*{\setmarginnotefont}[1]{\renewcommand*{\@bidituftesidenote@marginnote@font}{#1}} \newcommand*{\setcitationfont}[1]{\renewcommand*{\@bidituftesidenote@citation@font}{#1}} +\newcommand*{\setLTRcitationfont}[1]{\renewcommand*{\@biditufteLTRsidenote@citation@font}{#1}} \newcommand*{\@bidituftesidenote@sidenote@justification}{\@bidituftesidenote@justification@autodetect} \newcommand*{\@bidituftesidenote@marginnote@justification}{\@bidituftesidenote@justification@autodetect} \newcommand*{\@bidituftesidenote@citation@justification}{\@bidituftesidenote@justification@autodetect} @@ -236,7 +238,7 @@ bidi implementation of tufte sidenote] {\BR@bibitem[#1]{#2}}% \BR@c@bibitem{#2}% } -\nobibliography* % pre-loads the bibliography keys +\hopatch@AfterPackage{bidi}{\nobibliography*} % pre-loads the bibliography keys %% \newcounter{@bidituftesidenote@num@bibkeys}% \newcommand{\@bidituftesidenote@normal@cite}[2][0pt]{% @@ -258,6 +260,44 @@ bidi implementation of tufte sidenote] }% }% } +\newcommand{\@biditufteLTRsidenote@normal@cite}[2][0pt]{% + % Snag the last bibentry in the list for later comparison + \let\@temp@last@bibkey\@empty% + \@for\@temp@bibkey:=#2\do{\let\@temp@last@bibkey\@temp@bibkey}% + \LTRsidenote[][#1]{% + % Loop through all the bibentries, separating them with semicolons and spaces + \normalsize\normalfont\@biditufteLTRsidenote@citation@font% + \setcounter{@bidituftesidenote@num@bibkeys}{0}% + \@for\@temp@bibkeyx:=#2\do{% + \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}% + {\ifthenelse{\equal{\value{@bidituftesidenote@num@bibkeys}}{0}}{}{and\ }% + \@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx}}% + {\@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx};\ }% + \stepcounter{@bidituftesidenote@num@bibkeys}% + }% + }% +} +\newcommand{\@biditufteRTLsidenote@normal@cite}[2][0pt]{% + % Snag the last bibentry in the list for later comparison + \let\@temp@last@bibkey\@empty% + \@for\@temp@bibkey:=#2\do{\let\@temp@last@bibkey\@temp@bibkey}% + \RTLsidenote[][#1]{% + % Loop through all the bibentries, separating them with semicolons and spaces + \normalsize\normalfont\@bidituftesidenote@citation@font% + \setcounter{@bidituftesidenote@num@bibkeys}{0}% + \@for\@temp@bibkeyx:=#2\do{% + \ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}% + {\ifthenelse{\equal{\value{@bidituftesidenote@num@bibkeys}}{0}}{}{and\ }% + \@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx}}% + {\@bidituftesidenote@trim@spaces\@temp@bibkeyx% trim spaces around bibkey + \bibentry{\@temp@bibkeyx};\ }% + \stepcounter{@bidituftesidenote@num@bibkeys}% + }% + }% +} %% \gdef\@bidituftesidenote@citations{}% list of cite keys \newcommand\@bidituftesidenote@add@citation[1]{\relax% adds a new bibkey to the list of cite keys @@ -296,6 +336,8 @@ bidi implementation of tufte sidenote] } %% \let\cite\@bidituftesidenote@normal@cite +\let\LTRcite\@biditufteLTRsidenote@normal@cite +\let\RTLcite\@biditufteRTLsidenote@normal@cite %% \RequirePackage{optparams}% for our new sidenote commands -- provides multiple optional arguments for commands \providecommand{\footnotelayout}{\@bidituftesidenote@sidenote@font\@bidituftesidenote@sidenote@justification} @@ -403,6 +445,8 @@ bidi implementation of tufte sidenote] }% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command \unskip\ignorespaces% remove extra white space \kern-\multiplefootnotemarker% remove \kern left behind by sidenote \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked @@ -430,6 +474,8 @@ bidi implementation of tufte sidenote] }% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command \unskip\ignorespaces% remove extra white space \kern-\multiplefootnotemarker% remove \kern left behind by sidenote \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked @@ -457,6 +503,8 @@ bidi implementation of tufte sidenote] }% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command \unskip\ignorespaces% remove extra white space \kern-\multiplefootnotemarker% remove \kern left behind by sidenote \kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked @@ -476,6 +524,8 @@ bidi implementation of tufte sidenote] \bidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command } \newcommand\LTRmarginnote[2][0pt]{% \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command @@ -483,6 +533,8 @@ bidi implementation of tufte sidenote] \LTRbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command } \newcommand\RTLmarginnote[2][0pt]{% \let\cite\@bidituftesidenote@infootnote@cite% use the in-sidenote \cite command @@ -490,6 +542,8 @@ bidi implementation of tufte sidenote] \RTLbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\@bidituftesidenote@marginnote@justification\@bidituftesidenote@margin@par\vspace*{-1\baselineskip}\noindent #2}% \@bidituftesidenote@print@citations% print any citations \let\cite\@bidituftesidenote@normal@cite% go back to using normal in-text \cite command + \let\LTRcite\@biditufteLTRsidenote@normal@cite% go back to using normal in-text \LTRcite command + \let\RTLcite\@biditufteRTLsidenote@normal@cite% go back to using normal in-text \RTLcite command } \endinput %% |