summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xepersian/bidituftesidenote-xepersian.def
blob: 34ec253fc2d10d5a9ba68e9e10bb02655d28da32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%%
%% This is file `bidituftesidenote-xepersian.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xepersian.dtx  (with options: `bidituftesidenote-xepersian.def')
%% 
%%   ______________________________________
%%   Copyright © 2008–2012  Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\ProvidesFile{bidituftesidenote-xepersian.def}[2011/06/18 v0.1 xepersian changes to bidituftesidenote package]
\long\def\@LTRbidituftesidenote@sidenote[#1][#2]#3{%
  \let\cite\@bidituftesidenote@infootnote@cite%   use the in-sidenote \cite command
  \gdef\@bidituftesidenote@citations{}%           clear out any old citations
  \ifthenelse{\NOT\isempty{#2}}{%
    \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{#2}%
  }{%
    \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}%
  }%
  \ifthenelse{\isempty{#1}}{%
    % no specific footnote number provided
    \stepcounter\@mpfn%
    \protected@xdef\@thefnmark{\thempfn}%
    \@footnotemark\@LTRfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{\latinfont#3}%
  }{%
    % specific footnote number provided
    \begingroup%
      \csname c@\@mpfn\endcsname #1\relax%
      \unrestored@protected@xdef\@thefnmark{\thempfn}%
    \endgroup%
    \@footnotemark\@LTRfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{\latinfont#3}%
  }%
  \@bidituftesidenote@print@citations%            print any citations
  \let\cite\@bidituftesidenote@normal@cite%       go back to using normal in-text \cite 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
}
\long\def\@RTLbidituftesidenote@sidenote[#1][#2]#3{%
  \let\cite\@bidituftesidenote@infootnote@cite%   use the in-sidenote \cite command
  \gdef\@bidituftesidenote@citations{}%           clear out any old citations
  \ifthenelse{\NOT\isempty{#2}}{%
    \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{#2}%
  }{%
    \gsetlength{\@bidituftesidenote@sidenote@vertical@offset}{0pt}%
  }%
  \ifthenelse{\isempty{#1}}{%
    % no specific footnote number provided
    \stepcounter\@mpfn%
    \protected@xdef\@thefnmark{\thempfn}%
    \@footnotemark\@RTLfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{\persianfont#3}%
  }{%
    % specific footnote number provided
    \begingroup%
      \csname c@\@mpfn\endcsname #1\relax%
      \unrestored@protected@xdef\@thefnmark{\thempfn}%
    \endgroup%
    \@footnotemark\@RTLfootnotetext[\@bidituftesidenote@sidenote@vertical@offset]{\persianfont#3}%
  }%
  \@bidituftesidenote@print@citations%            print any citations
  \let\cite\@bidituftesidenote@normal@cite%       go back to using normal in-text \cite 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
}
\renewcommand\LTRmarginnote[2][0pt]{%
  \let\cite\@bidituftesidenote@infootnote@cite%   use the in-sidenote \cite command
  \gdef\@bidituftesidenote@citations{}%           clear out any old citations
  \LTRbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\latinfont\@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
}
\renewcommand\RTLmarginnote[2][0pt]{%
  \let\cite\@bidituftesidenote@infootnote@cite%   use the in-sidenote \cite command
  \gdef\@bidituftesidenote@citations{}%           clear out any old citations
  \RTLbidituftesidenotemarginpar{\hbox{}\vspace*{#1}\@bidituftesidenote@marginnote@font\persianfont\@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
}
%% 
%% Copyright © 2008–2012  Vafa Khalighi <vkhalighi@me.com>
%% 
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is “author-maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%% 
%% 
%% 
%%
%% End of file `bidituftesidenote-xepersian.def'.