summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/slidenotes/obox.sty
blob: 4959ef64a8a50e8e75a94c4b0b8ae4f5ed31fe4b (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
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{obox}[1995/09/04 vs 1.2]
%-------------------------------------------------------------------------------
% produce from #1{dimen} or #1(number) -> #1{number\unitlength}
\def\@pickonedim#1{\@ifnextchar(%)
	{\@@pickonedim{#1}}{#1}}
\def\@@pickonedim#1(#2){#1{#2\unitlength}}
%-------------------------------------------------------------------------------
% redefinition of oval uit picture omgeving
% \oval[position](width,height)[optional lrtb=parts]
% position where placed:
% o midpoint (default as in LaTeX picture environment)
% t top of oval at baseline
% b bottom of oval at baseline
% c halfheight of oval at baseline
% n neutral placement
\gdef\oval{\@ifnextchar[%]
	{\@oval}{\@oval[o]}}
\gdef\@oval[#1](#2,#3){\@ifnextchar[%]
	{\@@oval[#1](#2,#3)}{\@@oval[#1](#2,#3)[]}}
\gdef\@@oval[#1](#2,#3)[#4]{\begingroup\boxmaxdepth \maxdimen
  \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
  \@tfor\reserved@a :=#4\do{\csname @ov\reserved@a false\endcsname}%
  \@ovxx #2\unitlength \@ovyy #3\unitlength
  \@tempdimb \ifdim\the@ovalradius=\z@
  	\ifdim \@ovyy >\@ovxx \@ovxx \else \@ovyy \fi
  	\else \the@ovalradius \fi
  \advance \@tempdimb -\tw@\p@
  \@getcirc \@tempdimb
  \@ovro \ht\@tempboxa \@ovri \dp\@tempboxa
  \@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@
  \@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@
  \@circlefnt \setbox\@tempboxa
  \hbox{\if@ovr \@ovvert32\kern -\@tempdima \fi
  \if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi
  \if@ovt \@ovhorz \kern -\@ovxx \fi
  \if@ovb \raise \@ovyy \@ovhorz \fi}%
  \advance\@ovdx\@ovro \advance\@ovdy\@ovro 
  \if#1t\@ovdx\z@\@ovdy\tw@\@ovdy\fi
  \if#1b\@ovdx\z@\@ovdy\z@\fi
  \if#1c\@ovdx\z@\fi
  \if#1n\@ovdx\z@\@ovdy\dp\@tempboxa\fi
  \ht\@tempboxa\z@ \dp\@tempboxa\z@
  \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}%
  \endgroup}
%-------------------------------------------------------------------------------
% \obox[optional ovalradius(length)][optional linethickness-cmd]{box-contents}
\def\obox{\@ifnextchar[%]
	{\@obox}{\@@obox[][]}}
\def\@obox[#1]{\@ifnextchar[%]
	{\@@obox[#1]}{\@@obox[#1][]}}
\def\@@obox[#1][#2]#3{%
  \begingroup
    \@ifemptyarg{#1}{}{\ovalradius{#1}}%
  	\setbox\z@\hbox{\advance\fboxsep\@wholewidth \fboxrule\z@ \fbox{#3}}%
    \dimen@\ht\z@ \advance\dimen@\dp\z@ #2\let\unitlength\@empty
    \leavevmode\oval[n](\wd\z@,\dimen@)\box\z@
  \endgroup}
%-------------------------------------------------------------------------------
\def\ovalradius{\@pickonedim\@ovalradius}
\def\@ovalradius#1{\@tempdima#1\relax
	\edef\the@ovalradius{\number\@tempdima sp}\ignorespaces}
\def\ovalfraction#1{%
	\edef\the@ovalradius{#1\noexpand\@tempdimb}\ignorespaces}
\ovalradius{0pt}				% initialisation
%-------------------------------------------------------------------------------
\endinput