summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/curve2e/curve2e.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/curve2e/curve2e.dtx')
-rw-r--r--macros/latex/contrib/curve2e/curve2e.dtx127
1 files changed, 117 insertions, 10 deletions
diff --git a/macros/latex/contrib/curve2e/curve2e.dtx b/macros/latex/contrib/curve2e/curve2e.dtx
index 0367ab88e0..8fc95e6fc3 100644
--- a/macros/latex/contrib/curve2e/curve2e.dtx
+++ b/macros/latex/contrib/curve2e/curve2e.dtx
@@ -46,7 +46,7 @@ README.txt and curve2e-v161.sty.
%<+package>\ProvidesPackage{curve2e}%
%<+readme>File README.txt for package curve2e
%<*package|readme>
- [2020-10-03 v.2.2.10 Extension package for pict2e]
+ [2020-12-12 v.2.2.12 Extension package for pict2e]
%</package|readme>
%<*driver>
\documentclass{ltxdoc}\errorcontextlines=9
@@ -79,6 +79,8 @@ README.txt and curve2e-v161.sty.
\renewcommand\Parg[1]{\texttt{(#1)}}
\providecommand\eTeX{}
\renewcommand\eTeX{\lower0.5ex\hbox{$\varepsilon\!$}\TeX}
+\providecommand\pack{}
+\renewcommand\pack[1]{{\normalfont\texttt{#1}}}
\providecommand\Pbox{}
\newlength\PbDim
@@ -119,14 +121,6 @@ README.txt and curve2e-v161.sty.
\NewDocumentCommand\Pall{O{1.5} R(){0,0}}{\put(#2){\circle*{#1}}}
-\def\legenda(#1)#2{\put(#1){\setbox3333\hbox{$#2$}%
- \dimen3333\dimexpr\wd3333*\p@/\unitlength +3\p@\relax
- \edef\@tempA{\strip@pt\dimen3333}%
- \framebox(\@tempA,7){\box3333}}}
-
-\NewDocumentCommand\Zbox{R(){0,0} O{cc} m O{1}}{%
-\put(#1){\makebox(0,0)[#2]{\fboxrule=0pt\fboxsep=3pt\fbox{$#3$}}\makebox(0,0)[cc]{\circle*{#4}}}}
-
\providecommand\setfontsize{}
\DeclareRobustCommand\setfontsize[2][1.2]{%
@@ -183,7 +177,7 @@ README.txt and curve2e-v161.sty.
%</driver>
% \fi
%
-% \CheckSum{5510}
+% \CheckSum{5582}
% \begin{abstract}
% This file documents the |curve2e| extension package to the |pict2e|
% bundle implementation; the latter was described by Lamport
@@ -1376,6 +1370,119 @@ README.txt and curve2e-v161.sty.
% \end{macrocode}
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% \section{Labelling the graphical elements}
+%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% While drawing any thing with the \pack{curve2e} package, it might be
+% necessary to identify some graphical objects with some sort of “label”.
+%\footnote{Do not confuse this identifier label with the \cs{label}
+% command.}
+%
+% Some commands such as \cs{legenda} (legend), \cs{Zbox}, and \cs{Pbox}
+% have been always usede in the documentation of this package and its
+% siblings; but we used them in many other documents; therefore we thought
+% it was useful to have them available with the general user of
+% \pack{curve2e}.
+%
+%Their commands follow the following syntax.
+%|\Pbox|\parg{coordinates}\oarg{position}\marg{text}\oarg{dot diameter}\meta{\texttt{*}}\aarg{angle}
+%\begin{flushleft}\ttfamily\obeylines
+%|\Zbox|\parg{coordinates}\oarg{position}\marg{formula}\oarg{dot diameter}
+%|\legenda|\parg{coordinates}\marg{formula}
+%\end{flushleft}
+%
+% These commands have similar but different functionalities; the most
+% general one si |\Pbox|, while the others are simplified versions that
+% have a simpler syntax, and a subset of the |\Pbox| functionalities.
+% While we describe the arguments of |\Pbox| we emphasise the small
+% differences with the other two commands.
+%\begin{description}
+%\item[\meta{coordinates}] are the coordinates (explicit, or in vector
+% form) of the reference point of the “label”; for |\legenda| it is the
+% lower left corner of the framed legend contents. They are delimited
+% with the usual matched parentheses, and their default value is
+% \texttt{(0,0)}, therefore either the user specifies other coordinates,
+% or uses the |\put| command to place the legend where he prefers.
+%%
+%\item[\meta{position}] is the optional position of the “label” contents
+% relative the the reference point; the default is \texttt{cc} so that
+% the “label” is vertically and horizontally centred at the reference
+% point; actually these position parameters should always specified if
+% the dot diameter is positive (therefore visible), otherwise the
+% “label” and the dot overwrite eachother.
+%%
+%\item[\meta{text} \textnormal{or} \meta{formula}] may be almost
+% anything; where the argument is called \meta{formula} math mode
+% is the default; otherwise it is plain \meta{text}; in any case
+% it can be replaced by a box or a parbox, so that actually this
+% mandatory argument may contain almost anything.
+%%
+%\item[\meta{dot diameter}] the dot diameter default value is positive;
+% for |\Zbox| it is |1\unitlength| and the user should be careful in
+% modifying this value; but if the dot diameter is set to zero, the
+% dot is absent and the |\Zbox| command behaves almost as an unframed
+% legend. The small difference is that |\Zbox| accepts a \meta{position}
+% parameter while the |\legend| command does not.
+%%
+%\item[\meta{\texttt{*}}] is an optional star; if specified the
+% “label” is framed with a visible border, otherwise it is framed
+% with an invisible border but with a blank separator that tries to
+% adjust the border so that the “label” is always at the same distance
+% from the reference point; if this reference point corresponds to
+% a box corner it is reduced by approximately a factor equal to
+% $\sqrt{0.5}$, in oder to take into account the diagonal of the
+% blank border angle.
+%%
+%\item[\meta{angle}] is the rotation angle about the reference point
+% of the “label”; sometimes such “labels” have to be rotated 90°
+% anticlockwise; sometimes they need a positive or negative rotation
+% angle (in degrees) in order to match the general direction of the
+% “labelled” object, be it an oblique line, an axis, or whatever.
+% We found it very useful also to label the cartesian axes, but
+% also in other situations; for example to label the $x$ axis the
+% |\Pbox| command might have the arrow tip coordinates for the
+% reference point and have \texttt{tr} for the \meta{position};
+% for the $y$ axis, the reference point is again the arrow tip,
+% and again the position would be again \texttt{tr} if the “label”
+% sits on the left of the axis.
+%\end{description}
+%
+% \begin{macrocode}
+\providecommand\Pbox{}
+\RenewDocumentCommand\Pbox{D(){0,0} O{cc} m O{0.5ex} s D<>{0}}{%
+\put(#1){\rotatebox{#6}{\makebox(0,0){%
+\settowidth\PbDim{#2}%
+\edef\Rapp{\fpeval{\PbDim/{1ex}}}%
+\fptest{\Rapp > 1.5}{\fboxsep=0.5ex}{\fboxsep=0.75ex}%
+\IfBooleanTF{#5}{\fboxrule=0.4pt}{\fboxrule=0pt}%
+\fptest{#4 = 0sp}%
+ {\makebox(0,0)[#2]{\fbox{$\relax#3\relax$}}}%
+ {\edef\Diam{\fpeval{(#4)/\unitlength}}%
+ \makebox(0,0){\circle*{\Diam}}%
+ \makebox(0,0)[#2]{\fbox{$\relax\mathsf#3\relax$}}%
+ }}}%
+}\ignorespaces}
+
+\providecommand\Zbox{}
+\RenewDocumentCommand\Zbox{R(){0,0} O{cc} m O{1}}{%
+\put(#1){\makebox(0,0)[#2]{\fboxrule=0pt\fboxsep=3pt\fbox{$#3$}}\makebox(0,0)[cc]{\circle*{#4}}}\ignorespaces}
+
+\providecommand\legenda{}
+\RenewDocumentCommand\legenda{ D(){0,0} m}{\put(#1){\setbox3333\hbox{$#2$}%
+ \dimen3333\dimexpr\wd3333*\p@/\unitlength +3\p@\relax
+ \edef\@tempA{\strip@pt\dimen3333}%
+ \framebox(\@tempA,7){\box3333}}\ignorespaces}
+
+% \end{macrocode}
+
+% With the above labelling facilities and with use of the \pack{xfp}
+% functionalities it is not difficult to create diagrams with linear
+% or logarithmic axes. In effects the \pack{graphpaper} class contains
+% those various and other labelling macros and uses them. We plan to
+% extract some general macros from that class and to create a stand
+% alone package, so as to use them whenever the user wants to draw
+% some diagrams.
+
+%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Math operations on fractional operands}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is not the place to complain about the fact that all programs of