summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xepersian/bidituftesidenote-xepersian.def
blob: dea76999efa2ade6263c25860f5d5a169f6cefea (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
98
99
100
101
102
103
104
105
106
107
108
109
%%
%% This is file `bidituftesidenote-xepersian.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xepersian.dtx  (with options: `table,bidituftesidenote-xepersian.def')
%% 
%%   __________________________________________________
%%   Copyright (c) 2008--2016  Vafa Khalighi <persian-tex@tug.org>
%% 
%%   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.
%% 
%% 
%% \CheckSum{10108}
%% \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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{bidituftesidenote-xepersian.def}[2014/12/28 v0.2 xepersian changes to bidituftesidenote package]
\setLTRcitationfont{\@bidituftesidenote@marginfont\latinfont}
\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
}
\endinput
%%
%% End of file `bidituftesidenote-xepersian.def'.