Blame latex/style/dbk_callout.sty

Packit 0f19cf
\usepackage{overpic}
Packit 0f19cf
Packit 0f19cf
%********************
Packit 0f19cf
%* Graphic callouts *
Packit 0f19cf
%********************
Packit 0f19cf
Packit 0f19cf
% Where to put the <co> in the graphic
Packit 0f19cf
\newdimen\picfactorx
Packit 0f19cf
\newdimen\picfactory
Packit 0f19cf
\newdimen\picx
Packit 0f19cf
\newdimen\picy
Packit 0f19cf
Packit 0f19cf
% Evaluates the percent factors for x and y dimensions. The principle is that
Packit 0f19cf
% overpic gives a 100% for the biggest length (width or height).
Packit 0f19cf
% The coordonates given to \calspair being in percentage of the graphic
Packit 0f19cf
% dimension itself, the picfactors translate them to overpic percentages.
Packit 0f19cf
% 
Packit 0f19cf
% Variables set by overpic:
Packit 0f19cf
% \@tempcnta = width
Packit 0f19cf
% \@tempcntb = height
Packit 0f19cf
Packit 0f19cf
\def\picfactoreval{%
Packit 0f19cf
  \ifnum\@tempcnta>\@tempcntb%
Packit 0f19cf
    \picfactorx=1pt%
Packit 0f19cf
    \picfactory=\@tempcntb pt%
Packit 0f19cf
    \divide\picfactory by \@tempcnta%
Packit 0f19cf
  \else%
Packit 0f19cf
    \picfactory=1pt%
Packit 0f19cf
    \picfactorx=\@tempcnta pt%
Packit 0f19cf
    \divide\picfactorx by \@tempcntb%
Packit 0f19cf
  \fi%
Packit 0f19cf
}
Packit 0f19cf
Packit 0f19cf
\newcommand{\calspair}[3]{
Packit 0f19cf
  \sbox{\z@}{#3}%
Packit 0f19cf
  \picx=#1\picfactorx%
Packit 0f19cf
  \picy=#2\picfactory%
Packit 0f19cf
  \put(\strip@pt\picx,\strip@pt\picy){\makebox(0,0){\usebox{\z@}}}
Packit 0f19cf
}
Packit 0f19cf
Packit 0f19cf
%*********************
Packit 0f19cf
%* Verbatim callouts *
Packit 0f19cf
%*********************
Packit 0f19cf
Packit 0f19cf
% Counters for cross-referencing callouts
Packit 0f19cf
\newcounter{cocnt}
Packit 0f19cf
\newcounter{colref}
Packit 0f19cf
Packit 0f19cf
% How to represent the <co> markup.
Packit 0f19cf
% Big thanks to Jean-Côme Charpentier for his help.
Packit 0f19cf
%
Packit 0f19cf
\newlength{\co@width}
Packit 0f19cf
\newlength{\co@height}
Packit 0f19cf
\newlength{\balldiam}
Packit 0f19cf
\newlength{\ballcentre}
Packit 0f19cf
Packit 0f19cf
\def\conum#1{%
Packit 0f19cf
  \sbox{\z@}{\color{white}\sffamily\bfseries\tiny#1}% 
Packit 0f19cf
  % Box sizes for any number with two digits
Packit 0f19cf
  \sbox{\@ne}{\color{white}\sffamily\bfseries\tiny00}%
Packit 0f19cf
  \settowidth{\co@width}{\usebox{\@ne}}%
Packit 0f19cf
  \settoheight{\co@height}{\usebox{\@ne}}%
Packit 0f19cf
  % Find out the biggest length, to define the circle diameter
Packit 0f19cf
  \ifnum\co@width>\co@height
Packit 0f19cf
    \setlength{\balldiam}{\co@width}%
Packit 0f19cf
  \else
Packit 0f19cf
    \setlength{\balldiam}{\co@height}%
Packit 0f19cf
  \fi
Packit 0f19cf
  \balldiam=1.45\balldiam
Packit 0f19cf
  \ballcentre=0.5\balldiam
Packit 0f19cf
  \setlength{\unitlength}{1pt}% In the case it has been changed
Packit 0f19cf
  \begin{picture}(\strip@pt\balldiam,\strip@pt\balldiam) %
Packit 0f19cf
  \put(\strip@pt\ballcentre,\strip@pt\ballcentre){\circle*{\strip@pt\balldiam}}
Packit 0f19cf
  \put(\strip@pt\ballcentre,\strip@pt\ballcentre){\makebox(0,0){\usebox{\z@}}}
Packit 0f19cf
  \end{picture}%
Packit 0f19cf
}
Packit 0f19cf
Packit 0f19cf
% How to represent a <co> embedded in a listing
Packit 0f19cf
\def\co#1{\refstepcounter{cocnt}\conum{#1}}
Packit 0f19cf
Packit 0f19cf
% Make the <co> text and the label to link to
Packit 0f19cf
\def\coref#1#2{\co{#1}\label{#2}}
Packit 0f19cf
Packit 0f19cf
% Make only the <co> label to link to
Packit 0f19cf
\def\colabel#1{\refstepcounter{cocnt}\label{#1}}
Packit 0f19cf
Packit 0f19cf
% Make the <callout> label to link to
Packit 0f19cf
\def\collabel#1{\refstepcounter{colref}\label{#1}}