summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex')
-rw-r--r--graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex156
1 files changed, 64 insertions, 92 deletions
diff --git a/graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex b/graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex
index f9235a2eb7..c1e16c4e06 100644
--- a/graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex
+++ b/graphics/pgf/contrib/pgf-pie/pgf-pie-manual.tex
@@ -2,30 +2,32 @@
% chart. Written by Xu Yuan <xuyuan.cn@gmail.com> This file is part of
% pgf-pie you may get it at https://github.com/pgf-tikz/pgf-pie
-\documentclass{article}
-\usepackage[margin=12mm]{geometry}
-\usepackage{hyperref}
+\documentclass{ltxdoc}
\usepackage{pgf-pie}
\usetikzlibrary{shadows}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\usepackage{listings}
-\usepackage{color}
-\definecolor{listinggray}{gray}{0.92}
-\lstset{ %
-language=[LaTeX]TeX,
-breaklines=true,
-frame=single,
-% frameround=tttt,
-basicstyle=\footnotesize\ttfamily,
-backgroundcolor=\color{listinggray},
-keywordstyle=\color{blue}
+\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
+\usepackage{calc}
+\usepackage{graphicx}
+\input{pgfmanual-en-macros.tex}
+
+\pgfqkeys{/codeexample}{%
+ scale/.store in=\pgfpieexamplescale,
+ scale=1,
+ every codeexample/.style={%
+ width=.4\textwidth+7pt,
+ pre={
+ \setbox\codeexamplebox=\hbox\bgroup
+ },
+ post={
+ \egroup
+ \resizebox{\pgfpieexamplescale\textwidth}{!}{\box\codeexamplebox}%
+ },
+ },
}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\hypersetup{
+\usepackage[
colorlinks=true,
linkcolor=blue,
anchorcolor=black,
@@ -33,53 +35,23 @@ keywordstyle=\color{blue}
filecolor=magenta,
menucolor=red,
urlcolor=blue
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\demo}[2][1]{
- \begin{center}
- \begin{tabular}{cc}
- \begin{minipage}{.49\linewidth}
- \centering
- \resizebox{#1\linewidth}{!}{
- \input{demo/#2}
- }
- \end{minipage}
- &
- \begin{minipage}{.45\linewidth}
- \lstinputlisting{demo/#2}
- \end{minipage}
- \end{tabular}
- \end{center}
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\example}[2][1]{
- \begin{center}
- \resizebox{#1\linewidth}{!}{
- \input{demo/#2}
- }
- \end{center}
- \lstinputlisting{demo/#2}
-}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+]{hyperref}
+
+\newcommand\pgfpiename{\texttt{pgf-pie}}
\begin{document}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\title{Drawing Pie Chart by using \texttt{pgf-pie}}
+
+\title{Drawing Pie Chart by using \pgfpiename}
\author{\href{mailto:xuyuan.cn@gmail.com}{Yuan Xu}}
-\date{\today{}~(v0.3)}
+\date{\today{}~(v0.5)}
\maketitle
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{abstract}
- \texttt{pgf-pie} is a LaTeX package for drawing pie chart (and
+ \pgfpiename\ is a LaTeX package for drawing pie chart (and
variant charts). As stated by its name, it is based on a very
- popular graphic package \texttt{PGF/TikZ}. This document presents
- the usage of \texttt{pgf-pie} and collects some pie charts as
- examples. \texttt{pgf-pie} can be downloaded from
+ popular graphic package \pgfname/\tikzname. This document presents
+ the usage of \pgfpiename\ and collects some pie charts as
+ examples. \pgfpiename\ can be downloaded from
\href{https://github.com/pgf-tikz/pgf-pie}{https://github.com/pgf-tikz/pgf-pie}.
\end{abstract}
@@ -88,28 +60,28 @@ keywordstyle=\color{blue}
\section{Usage}
\subsection{First Pie}
-\lstinline|\pie| is the only coomand that provided by
-\texttt{pgf-pie}. The argument is a list of number and text
-combination in the formate of \texttt{number/text}, i.e. \texttt{10/A,
- 20/B, 30/C, 40/D}. The result is shown in figure \ref{fig:first-pie}.
+|\pie| is the only coomand that provided by
+\pgfpiename. The argument is a list of number and text
+combination in the formate of |number/text|, i.e. |10/A, 20/B, 30/C, 40/D|.
+The result is shown in figure \ref{fig:first-pie}.
\begin{figure}
\centering
- \demo[0.6]{first-pie}
+ \codeexample[scale=0.25,from file={demo/first-pie.tex}]
\caption{The first pie.}
\label{fig:first-pie}
\end{figure}
\subsection{Position, Rotation, Size}
-The center of chart can be set by \texttt{pos}, default is
-\texttt{\{0,0\}}. The chart can be rotated by setting \texttt{rotate}
-(in degrees). The size of chart can be set by \texttt{radius}, default
+The center of chart can be set by |pos|, default is
+|{0,0}|. The chart can be rotated by setting |rotate|
+(in degrees). The size of chart can be set by |radius|, default
is 3.
-\demo{radius}
+\codeexample[scale=0.4,from file={demo/radius.tex}]
\subsection{Color}
-The color can be specified by \texttt{color}, the default color wheel
+The color can be specified by |color|, the default color wheel
is shown in figure \ref{fig:color-wheel}.
\begin{figure}
\centering
@@ -118,52 +90,52 @@ is shown in figure \ref{fig:color-wheel}.
\label{fig:color-wheel}
\end{figure}
-\demo{color}
+\codeexample[scale=0.4,from file={demo/color.tex}]
\subsection{Explode}
-\demo{explode}
+\codeexample[scale=0.4,from file={demo/explode.tex}]
\subsection{Angle of slices}
-The value of \texttt{sum} indicats the sum of all data in the chart,
+The value of |sum| indicats the sum of all data in the chart,
it is 100 by default. It can be calculated automatically when
-\texttt{auto} is set. Then the angle of slices are determined by
-number value and \texttt{sum}.
+|auto| is set. Then the angle of slices are determined by
+number value and |sum|.
-\demo{sum}
+\codeexample[scale=0.4,from file={demo/sum.tex}]
\subsection{Text}
\subsubsection{Number}
-Two parameters can be used to decorate number: \texttt{before number}
-and \texttt{after number}. Both are empty by default, but if
-\texttt{sum=100}, \texttt{after number} will be set to \%
+Two parameters can be used to decorate number: |before number|
+and |after number|. Both are empty by default, but if
+|sum=100|, |after number| will be set to \%
automatically if user doesn't set it.
-\demo[0.6]{before-after-number}
+\codeexample[scale=0.25,from file={demo/before-after-number.tex}]
-The number also can be hide by \texttt{hide number}:
+The number also can be hide by |hide number|:
-\demo[0.6]{hide-number}
+\codeexample[scale=0.25,from file={demo/hide-number.tex}]
\paragraph{Scale font}
The size of font in size pie can be scaled according to how big the
part is automatically.
-\demo[0.6]{scalefont}
+\codeexample[scale=0.25,from file={demo/scalefont.tex}]
\subsubsection{Label text}
-The value of \texttt{text} can be \texttt{label}(default),
-\texttt{pin}, \texttt{inside} or \texttt{legend}.
+The value of |text| can be |label| (default),
+|pin|, |inside| or |legend|.
-\demo[0.6]{text}
+\codeexample[scale=0.25,from file={demo/text.tex}]
-\demo[0.5]{text-inside}
+\codeexample[scale=0.25,from file={demo/text-inside.tex}]
-\demo[0.6]{legend}
+\codeexample[scale=0.25,from file={demo/legend.tex}]
\subsection{More about style}
\subsubsection{shadow}
-\demo[0.6]{shadow}
+\codeexample[scale=0.25,from file={demo/shadow.tex}]
\section{Variant Charts}
\subsection{Polar area diagram}
@@ -171,17 +143,17 @@ The polar area diagram is similar to a usual pie chart, except sectors
are equal angles and differ rather in how far each sector extends from
the center of the circle.
-\demo[0.6]{polar}
+\codeexample[scale=0.25,from file={demo/polar.tex}]
\subsection{Square}
-\demo[0.6]{square}
+\codeexample[scale=0.25,from file={demo/square.tex}]
-Note: \texttt{explode} has no affects in sqaure chart.
+Note: |explode| has no affects in sqaure chart.
\subsection{Clouds}
-\demo[0.6]{cloud}
+\codeexample[scale=0.25,from file={demo/cloud.tex}]
\section{Examples}
@@ -189,7 +161,7 @@ Note: \texttt{explode} has no affects in sqaure chart.
% \example{population}
\section{Acknowledgements}
-Many people contributed to \texttt{pgf-pie} by reporting problems,
+Many people contributed to \pgfpiename\ by reporting problems,
suggesting various improvements or submitting code. Here is a list of
these people:
\href{mailto:mohammed.alfaki@ii.uib.no}{Mohammed Alfaki},