summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/subsupscripts/SubSupScripts.tex
blob: 3d3e9c35d99539c92332fd3a79b5e3b1e75f213c (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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
\documentclass[green,a4paper,oneside,openany,noparindent,noparskip,article,nomatter]{bookest}

\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{subsupscripts}
\usepackage{fancyvrb}
\usepackage{stmaryrd}
\usepackage{palatino}
\usepackage{hyperref}

\VerbatimFootnotes

\newcommand{\choice}{\oplus} % Usual notation
\newcommand{\Choice}{$\choice$}
\newcommand{\Boxast}{$\boxast$}
\newcommand{\Boxcircle}{$\boxcircle$}
\newcommand{\Boxbslash}{$\boxbslash$}
\newcommand{\Boxbox}{$\boxbox$}
\newcommand{\Elll}{$\ell_L$}
\newcommand{\Ellr}{$\ell_R$}

\setbibname{References}

\setleftmark{}
\setrightmark{}

%pdfLaTeX
\hypersetup{
pdftitle={SubSupScripts},
pdfsubject={A LaTeX package to provide new commands for subscripts and superscripts.},
pdfauthor={Riccardo Bresciani},
pdfkeywords={SubSupScripts, LaTeX, Subscript, Superscript, TeX},
pdfstartview=FitV,
%colorlinks
}


% Aliases
\newcommand{\ie}{\emph{i.e.} }

\author{Riccardo Bresciani}
\title{SubSupScripts\hfill{\small\href{http://tex.nopkoguo.net/subsupscripts}{http://tex.nopkoguo.net/subsupscripts}}}
\newcommand{\belowLine}{{\normalsize Version 1.0 --- \today}}

\makeatletter
\renewcommand{\maketitle}{\thispagestyle{plain}{\Huge\textbf{\colorB\@title}\Large\\\vspace{2ex}
\@author{\colorA\hrule}\vspace{1ex}\belowLine\\\vspace{2ex}}}
\makeatother

  \geometry{
     hmargin=2.3cm,
     vmargin={3cm,3cm},
     bindingoffset=0mm,
     columnsep=20pt	
  }
  
\begin{document}

\maketitle

\begin{abstract}{Brief description of the package:}
This package provides some new more flexible commands to typeset subscripts and superscripts in mathematical mode.
\end{abstract}


\artsection{Usage}
\artsubsection{Default lengths}
The following commands use the default lengths, as defined in \ref{lengths}. They are quite tight and are useful in case of an operator such as \Choice.
\begin{itemize}
\item \Verb[commandchars=-\[\]]+\fourscripts{-Choice}{-Boxast}{-Boxbox}{-Boxcircle}{-Boxbslash}+

Output: $\fourscripts{\choice}{\boxast}{\boxbox}{\boxcircle}{\boxbslash}$
\item \Verb[commandchars=-\[\]]+\lrsubscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\lrsubscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\lrsuperscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\lrsuperscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\twolscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\twolscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\tworscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\tworscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\lsubscript{-Choice}{-Boxbox}+

Output: $\lsubscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\lsuperscript{-Choice}{-Boxbox}+

Output: $\lsuperscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\rsubscript{-Choice}{-Boxbox}+

Output: $\rsubscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\rsuperscript{-Choice}{-Boxbox}+

Output: $\rsuperscript{\choice}{\boxbox}$
\end{itemize}

\artsubsection{Larger skips}

\largerSkips

The following commands use larger lengths, as defined in \ref{lengths}: this is achieved by running the command \Verb+\largerSkips+. This is needed when we want to apply subscripts or superscripts to something larger than \Choice, such as {\renewcommand{\choice}{expression} \Choice.


\begin{itemize}
\item \Verb[commandchars=-\[\]]+\fourscripts{-Choice}{-Boxast}{-Boxbox}{-Boxcircle}{-Boxbslash}+

Output: $\fourscripts{\choice}{\boxast}{\boxbox}{\boxcircle}{\boxbslash}$
\item \Verb[commandchars=-\[\]]+\lrsubscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\lrsubscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\lrsuperscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\lrsuperscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\twolscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\twolscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\tworscripts{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\tworscripts{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\[\]]+\lsubscript{-Choice}{-Boxbox}+

Output: $\lsubscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\lsuperscript{-Choice}{-Boxbox}+

Output: $\lsuperscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\rsubscript{-Choice}{-Boxbox}+

Output: $\rsubscript{\choice}{\boxbox}$
\item \Verb[commandchars=-\[\]]+\rsuperscript{-Choice}{-Boxbox}+

Output: $\rsuperscript{\choice}{\boxbox}$
\end{itemize}}

\artsubsection{Changing the default lengths}
The following commands can be used to change the default skips between subscripts and/or superscripts and \Choice:
\begin{itemize}
\item\Verb[commandchars=-\[\]]+\setSingleLSkip{-Elll}+ changes the value of \Verb+\singleleftscriptskip+ to \Elll: this affects the skip in all the commands putting a subscript and/or a superscript on the left side of \Choice;
\item\Verb[commandchars=-\[\]]+\setSingleRSkip{-Ellr}+ changes the value of \Verb+\singlerightscriptskip+ to \Ellr: this affects the skip in all the commands putting a subscript and/or a superscript on the right side of \Choice;
\item\Verb[commandchars=-\[\]]+\setDblLSkip{-Elll}+ changes the value of \Verb+\dblleftscriptskip+ to \Elll: this affects the left skip in all the commands putting a subscript and/or a superscript on both sides of \Choice;
\item\Verb[commandchars=-\[\]]+\setDblRSkip{-Ellr}+ changes the value of \Verb+\dblrightscriptskip+ to \Ellr: this affects the right skip in all the commands putting a subscript and/or a superscript on both sides of \Choice.
\end{itemize}

\artsubsection{Custom lengths}
If you want to define the left and right skip on the sides of \Choice\ each time you write a command, you have the following options ($\ell_I$ is 2ex in these examples):

\begin{itemize}
\item \Verb[commandchars=-\[\]]+\fourscriptsC{-Choice}{-Boxast}{-Boxbox}{-Boxcircle}{-Boxbslash}{-Elll}{-Ellr}+

Output: $\fourscriptsC{\choice}{\boxast}{\boxbox}{\boxcircle}{\boxbslash}{2ex}{2ex}$
\item \Verb[commandchars=-\[\]]+\lrsubscriptsC{-Choice}{-Boxbox}{-Boxcircle}{-Elll}{-Ellr}+

Output: $\lrsubscriptsC{\choice}{\boxbox}{\boxcircle}{2ex}{2ex}$
\item \Verb[commandchars=-\[\]]+\lrsuperscriptsC{-Choice}{-Boxbox}{-Boxcircle}{-Elll}{-Ellr}+

Output: $\lrsuperscriptsC{\choice}{\boxbox}{\boxcircle}{2ex}{2ex}$
\item \Verb[commandchars=-\(\)]+\twolscripts[-Elll]{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\twolscripts[2ex]{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\(\)]+\tworscripts[-Ellr]{-Choice}{-Boxbox}{-Boxcircle}+

Output: $\tworscripts[2ex]{\choice}{\boxbox}{\boxcircle}$
\item \Verb[commandchars=-\(\)]+\lsubscript[-Elll]{-Choice}{-Boxbox}+

Output: $\lsubscript[2ex]{\choice}{\boxbox}$
\item \Verb[commandchars=-\(\)]+\lsuperscript[-Elll]{-Choice}{-Boxbox}+

Output: $\lsuperscript[2ex]{\choice}{\boxbox}$
\item \Verb[commandchars=-\(\)]+\rsubscript[-Ellr]{-Choice}{-Boxbox}+

Output: $\rsubscript[2ex]{\choice}{\boxbox}$
\item \Verb[commandchars=-\(\)]+\rsuperscript[-Ellr]{-Choice}{-Boxbox}+

Output: $\rsuperscript[2ex]{\choice}{\boxbox}$
\end{itemize}


\artsection{What does the package actually contains?}
You don't really need to read the following stuff to use the package, but have a look at it if you want to have an idea of how the package works without looking at the code.

\artsubsection{Lengths definitions}\label{lengths}
This lenghts are used to define the default skips on the left and on the right side of $\choice$.
\begin{itemize}
\item\Verb+\singleleftscriptskip+: default -0.27ex, larger\footnote{This is obtained after invoking the \verb+\largerSkips+ command.} -0.16ex;
\item\Verb+\singlerightscriptskip+: default -0.18ex, larger -0.07ex;
\item\Verb+\dblleftscriptskip+: default -0.75ex, larger 0ex;
\item\Verb+\dblrightscriptskip+: default -0.645ex, larger 0ex.
\end{itemize}

\artsubsection{Base commands}
The base commands are only three, all the rest is built on top of them:

\begin{itemize}
\item\Verb+\newcommand{\fourscriptsC}[7]+

\hspace{4ex}\Verb+{{\null}^{#2}_{#3}\hspace{#6}#1\hspace{#7}{\null}^{#4}_{#5}}+

\item\Verb+\newcommand{\twolscripts}[4]+

\hspace{4ex}\Verb+[\singleleftscriptskip]{{\null}^{#3}_{#4}\hspace{#1}#2}+

\item\Verb+\newcommand{\tworscripts}[4]+

\hspace{4ex}\Verb+[\singlerightscriptskip]{#2\hspace{#1}{\null}^{#3}_{#4}}+
\end{itemize}

\artsection{Contacts}
As you can see this package boils down to just a few new command definitions, but it can help save some time --- I wrote it because I was not really satisfied of what I had found searching the web.

\ppar
If you have comments or want to report any bug, please send a mail to \textsl{\href{mailto:subsupscripts@tex.nopkoguo.net}{subsupscripts@tex.nopkoguo.net}}.

\end{document}