%% curvedarrowsdoc.tex
%% Copyright 2006 Glad Deschrijver <Glad.Deschrijver(at)UGent.be>
%%
%% curvedarrows - A LaTeX package for producing curved arrows
%% Requires the package pgf (http://sourceforge.net/projects/pgf/)
%
% 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.
%
% This work consists of the files curvedarrows.sty and curvedarrowsdoc.tex.
%
% -----------------------------------------------------------------------

\documentclass[a4paper]{article}

\usepackage{curvedarrows}

\usepackage{amsmath}
\usepackage{amssymb}
\newcommand{\Real}{\mathbb{R}}

\usepackage{color}
\definecolor{codebackground}{rgb}{0.95,0.95,0.8}
\definecolor{examplebackground}{rgb}{0.8,0.8,1}

\newcommand{\pgfname}{\textsc{pgf}}
\newcommand{\tikzname}{Ti\emph{k}Z}
\newcommand{\emunit}{\mathop{\mathrm{em}}\nolimits}
% inflection point, point of inflexion (buigpunt)
% \newcommand{\inflex}{\mathop{\mathrm{inflex}}\nolimits}

\usepackage{verbatim}
% Got the following code from ctex-faq.sty, v1.16 2004/09/27
\makeatletter
\newwrite\example@out
\def\example@start{%
  \begingroup
  \@bsphack
  \immediate\openout \example@out \jobname.tmp
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\example@out{\the\verbatim@line}}%
  \verbatim@start}
\def\example@finish{\immediate\closeout\example@out\@esphack\endgroup}
\newenvironment{example}{\example@start}{\example@finish}
\newcommand{\examplecode}{%
  \begin{center}
  \colorbox{codebackground}{%
    \begin{minipage}{.97\textwidth}
      \verbatiminput{\jobname.tmp}
    \end{minipage}
  }%
  \end{center}
}
\newcommand{\exampleoutput}{%
  \begin{center}
  \colorbox{examplebackground}{%
    \begin{minipage}{.97\textwidth}
      \input{\jobname.tmp}
    \end{minipage}
  }%
  \end{center}
}
\makeatother
% End code from ctex-faq.sty, v1.16 2004/09/27

\begin{document}

\title{The \texttt{curvedarrows} package}
\author{Glad Deschrijver\\[.2em]\texttt{Glad.Deschrijver@{}UGent.be}}
\date{v0.2 (2006/12/11)}
\maketitle

\section{Usage}

The package should be loaded in your LaTeX document with the command
\begin{verbatim}
  \usepackage{curvedarrows}
\end{verbatim}
This package requires the package \pgfname\ with the \tikzname\ frontend
(both can be obtained at \texttt{http://sourceforge.net/projects/pgf/}).

The package provides the commands necessary to make tables which
show the behavior of the graph of a $\Real \to \Real$ function:
\begin{itemize}
\item \verb+\nehatching+ (\nehatching):\\
  provides a rectangular area filled with a hatching pattern formed
  by north east oriented lines;

\item \verb+\sehatching+ (\sehatching):\\
  provides a rectangular area filled with a hatching pattern formed
  by south east oriented lines;

\item \verb+\hatching+:\\
  alias for \verb+\nehatching+;

\item \verb+\clnearrow+ (\clnearrow):\\
  provides a curved lower bended, north east oriented arrow;

\item \verb+\clsearrow+ (\clsearrow):\\
  provides a curved lower bended, south east oriented arrow;

\item \verb+\cunearrow+ (\cunearrow):\\
  provides a curved upper bended, north east oriented arrow;

\item \verb+\cusearrow+ (\cusearrow):\\
  provides a curved upper bended, south east oriented arrow;

\item \verb+\convincr+:\\
  alias for \verb+\clnearrow+; this arrow specifies that the graph
  of the function is convex increasing;

\item \verb+\convdecr+;\\
  alias for \verb+\clsearrow+; this arrow specifies that the graph
  of the function is convex decreasing;

\item \verb+\concincr+;\\
  alias for \verb+\cunearrow+; this arrow specifies that the graph
  of the function is concave increasing;

\item \verb+\concdecr+;\\
  alias for \verb+\cusearrow+; this arrow specifies that the graph
  of the function is concave decreasing.
\end{itemize}

The following variables can be changed in order to modify the style of
the arrows:
\begin{itemize}
\item \verb+\curvedarrowslinewidth+:\\
  specify the line width of the arrows (the default value
  $0.035\emunit$ ensures that the line width changes according to the
  font size of the surrounding text);

  e.g.\ \verb+\renewcommand{\curvedarrowslinewidth}{0.035em}+
  sets the line width of the arrows to $0.035\emunit$;

\item \verb+\curvedarrowstip+:\\
  specify the arrow tip (any tip provided by the \pgfname\ arrows
  library can be specified; see the \pgfname\ documentation for more
  information);

  e.g.\ \verb+\renewcommand{\curvedarrowstip}{latex}+
  sets the arrow tip to
  \begin{pgfpicture}{0em}{-.12em}{1.05em}{.18em}
    \pgfsetxvec{\pgfpoint{2.85em}{0em}}
    \pgfsetyvec{\pgfpoint{0em}{2.85em}}
    \pgfsetlinewidth{\curvedarrowslinewidth}
    \pgfsetendarrow{\csname pgfarrow\curvedarrowstip\endcsname}
    \pgfmoveto{\pgfxy(0,.06)}
    \pgflineto{\pgfxy(.3,.06)}
    \pgfstroke
  \end{pgfpicture}.
\end{itemize}

\section{Examples}

The code
\begin{example}
\begin{center}
  \begin{tabular}{r|cc}
    & increasing & decreasing\\
    \hline
    convex & \clnearrow & \clsearrow\\
    concave & \cunearrow & \cusearrow
  \end{tabular}
\end{center}
\end{example}
\examplecode
produces the following table:
\exampleoutput

\newpage
\noindent The code
\begin{example}
% Inflexion point
\newcommand{\inflex}{\mathop{\mathrm{inflex}}\nolimits}

Consider the function specified by $\displaystyle f(x) =
\frac{\ln(x)}{x^2}$.  The first and the second derivative
are given by
\begin{align*}
  f'(x)  & = \frac{1-2\ln(x)}{x^3},\\
  f''(x) & = \frac{6\ln(x)-5}{x^4}.
\end{align*}
The behavior of the graph of $f$ is shown in the following
tables:
\[
  \begin{array}{r|*9{c}}
    x & & & 0 & & \exp\left(\frac{1}{2}\right)
      & & \exp\left(\frac{5}{6}\right) & &\\
    \hline
    f'(x)  & & \hatching & | & + & 0 & - & - & - &\\
    f''(x) & & \hatching & | & - & - & - & 0 & + &\\
    \hline
    f(x) & & \hatching & | & \nearrow & \max
         & \searrow & \inflex & \searrow
  \end{array}
\]
and
\[
  \setlength{\arraycolsep}{.6em}
  \renewcommand{\arraystretch}{1.2}
  \begin{array}{r|@{\hspace{1.5em}}*7{c}@{\hspace{1.5em}}}
    x & & 0 & & \exp\left(\frac{1}{2}\right)
      & & \exp\left(\frac{5}{6}\right) &\\
    \hline
    f'(x)  & \hatching & | & + & 0 & - & - & -\\
    f''(x) & \hatching & | & - & - & - & 0 & +\\
    \hline
    f(x) & \hatching & | & \concincr & \max
         & \concdecr & \inflex & \convdecr\\
  \end{array}
\]
\end{example}
\examplecode
produces the following:
\exampleoutput

\end{document}

