blob: 32cfb193619220d049eb548b1591b5750aaff375 (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
%%
%% This is file `mnotes.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mnotes.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2013 by S Luz <luzs@acm.org>
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
%% or (at your option) any later version. The latest version of this
%% license is in
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of LaTeX version
%% 2003/12/01 or later.
%%
\ProvidesPackage{mnotes}[%
2013/20/04 v0.7 margin notes for collaborative document editing]
\expandafter\ifx\csname mnotespaperwidth\endcsname\relax
\newdimen\mnotespaperwidth
\mnotespaperwidth1.05\paperwidth
\fi
\newlength{\MNOTEWIDTH}
\setlength{\MNOTEWIDTH}{2.2cm}
\newcommand{\MNCOLOUR}{red}
\newcommand{\MNFONT}{\tiny}
\newif\if@mnotes@hide
\@mnotes@hidefalse
\newif\if@mnotes@basic
\@mnotes@basicfalse
\newif\if@mnotes@sidenotes
\@mnotes@sidenotesfalse
\newif\if@mnotes@scale
\@mnotes@scalefalse
\newif\if@mnotes@reverseconnect
\@mnotes@reverseconnectfalse
\RequirePackage{kvoptions}
\DeclareVoidOption{basic}{\@mnotes@basictrue}
\DeclareVoidOption{sidenotes}{\@mnotes@sidenotestrue}
\DeclareVoidOption{hide}{\@mnotes@hidetrue \AtEndOfPackage{\HideMNOTES{}}}
\DeclareVoidOption{reverseconnect}{\@mnotes@reverseconnecttrue}
\SetupKeyvalOptions{family=mnotes, prefix=mnotes@}
\DeclareStringOption{scale}[1.05]
\define@key{mnotes}{scale}{\if@mnotes@hide\else%
\pdfpagewidth#1\paperwidth\@mnotes@scaletrue\fi}
\DeclareVoidOption{centre}{\if@mnotes@scale\hoffset\pdfpagewidth
\advance\hoffset-\paperwidth
\hoffset.5\hoffset\fi}
\DeclareStringOption{mnwidth}[\MNOTEWIDTH]
\define@key{mnotes}{mnwidth}{\setlength{\MNOTEWIDTH}{#1}}
\DeclareStringOption{boxcolour}
\define@key{mnotes}{boxcolour}{\renewcommand{\MNCOLOUR}{#1}}
\DeclareStringOption{fontsize}[6]
\define@key{mnotes}{fontsize}{%
\count1=#1 \multiply \count1 by 116 \divide \count1 by 100%
\def\MNFONT{\fontsize{#1}{\count1}\selectfont}}
%\ExecuteOptions{}
\ProcessKeyvalOptions{mnotes}
\if@twocolumn\if@mnotes@scale\hoffset\pdfpagewidth
\advance\hoffset-\paperwidth
\hoffset.5\hoffset\fi\fi
\if@mnotes@basic
\RequirePackage{color}
\newif\ifoddpage %% define \ifoddpage even though it's not used to
\else %% avoid extra bracket error
\if@mnotes@sidenotes
\RequirePackage{sidenotes}
\else
\RequirePackage{marginnote}
\renewcommand\marginpar\marginnote
\fi
\RequirePackage{tikz}
\RequirePackage{ifoddpage}
\fi
\if@mnotes@basic
\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH}
\newcommand{\MNOTEon}[2][\MNCOLOUR]{%
\marginpar%
[{\MNFONT\raggedleft\color{#1}\em #2}]%
{\MNFONT\raggedright\color{#1}\em #2}}%
\else% not basic
\newcommand{\MNOTEon}[2][\MNCOLOUR]{
\setlength{\marginparsep}{6pt}\setlength{\marginparwidth}{\MNOTEWIDTH}
\begin{tikzpicture}[remember picture, baseline=-0.75ex]%
\node [coordinate] (textPOS) {};%
\end{tikzpicture}%
\if@mnotes@sidenotes
\sidenotetext[\tiny.]%
{\MNFONT\raggedright\em%
\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}
}%
\else
\marginpar%
[{\MNFONT\raggedleft\em\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}}]%
{{\MNFONT\raggedright\em%
\begin{tikzpicture}[remember picture]%
\draw node [draw=#1,text width=\MNOTEWIDTH-1pt] (notePOS) {#2};%
\end{tikzpicture}%
}}%
\fi%
\if@twocolumn%
\if@firstcolumn%
\if@mnotes@reverseconnect
\mnoteswestlink{#1}%
\else
\mnoteseastlink{#1}%
\fi
\else%
\if@mnotes@reverseconnect
\mnoteseastlink{#1}%
\else
\mnoteswestlink{#1}%
\fi
\fi%
\else%
\if@twoside%
\checkoddpage%
\ifoddpage%\ifodd\value{mn@abspage}%
\mnoteswestlink{#1}%
\else%
\mnoteseastlink{#1}%
\fi%
\else%
\mnoteswestlink{#1}%
\fi%
\fi%
}%
\newcommand{\mnoteseastlink}[1]{%
\begin{tikzpicture}[remember picture, overlay]%
\draw[#1,-]%
([yshift=-0.2cm] textPOS)%
-|([xshift=-0.1pt] notePOS.east);%
\end{tikzpicture}%
}
\newcommand{\mnoteswestlink}[1]{%
\begin{tikzpicture}[remember picture, overlay]%
\draw[#1,-]%
([yshift=-0.2cm] textPOS)%
-|([xshift=-0.1pt] notePOS.west);%
\end{tikzpicture}%
}
\fi
\newcommand{\MNOTE}{\MNOTEon}
\newcommand{\HideMNOTES}{\renewcommand{\MNOTE}[2][red]{}}
\newcommand{\ShowMNOTES}{\renewcommand{\MNOTE}{\MNOTEon}}
\newcommand{\ReverseMNConnect}{%
\if@mnotes@reverseconnect\@mnotes@reverseconnectfalse
\else\@mnotes@reverseconnecttrue\fi}
\endinput
%%
%% End of file `mnotes.sty'.
|