Debian Codegraph @

texmf-dist/doc/latex/bardiag/bardiag1.tex

raw
1 \documentclass[12pt]{article}
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 \usepackage{barddoc}
4
5 \usepackage{xr}
6 \externaldocument{bardiag}
7
8 \title{The \bard package: documentation part 2
9 \thanks{This file has version number \barvers and describes \bard ver.\barvers}
10 }
11
12 \begin{document}
13 \maketitle
14
15 \setcounter{section}{3}
16 \mysection{Horizontal mode \label{sec:4}}
17
18 There is also a possibility to draw a diagram with horizontally oriented
19 bars. An example of such a diagram is shown in \figref{fig4:1}
20
21 \begin{figure}[!ht]\centering
22 \renewcommand{\bdorientation}{\bdhor}
23 \input{figs/examp6.tex}
24 \caption{\label{fig4:1} Example of a diagram drawn in the horizontal mode.
25 Compare with {\figref{fig:9}}. The listing can be found in
26 section \ref{sec:4:1}}
27 \end{figure}
28
29 The idea is that one has to be able to ``rotate'' a diagram without
30 changing to much in the source. For this purpose a parameter
31 \verb+\bdorientation+ is introduced. It should have one of two values:
32 \verb+\bdvert+ (default) and \verb+\bdhor+, meaning vertical and
33 horizontal. The \figref{fig4:1} is drawn with the following piece of
34 code
35 \begin{lstlisting}{}
36 \begin{figure}[!ht]\centering
37 \renewcommand{\bdorientation}{\bdhor}
38 \input{figs/examp6.tex}
39 \caption{xxxx}
40 \end{figure}
41 \end{lstlisting}
42 \noindent
43 Line 2 sets the orientation.
44
45 The main point here is that, while calling \texttt{bardiagrambegin}
46 [see section~\ref{sec:4:1} for the listing], one changes the meaning
47 of its parameters. If before the arguments \#1 and \#2 meant X(=horizontal) and
48 Y(=vertical) sizes of the framed part of the diagram, then now one has
49 to call Y the direction along the bars. So, after\\
50 \verb+\renewcommand{\bdorientation}{\bdhor}+\\
51 X becomes vertical and Y horizontal. It sounds crazy, I know.
52 In fact, it means that you don't need to change the arguments
53 of \verb+\beginbardiag+ to
54 rotate the diagram. Only \verb+\bdorientationin+ should be
55 redefined. The same holds for unit lengths (args \#6 and \#7).
56
57 The same idea may work for a legend - its argument are now ``measured''
58 perpendicular to the bars (\#1) and along the bars (\#2). Still, you
59 will probably need to shift the legend by hand to make it look pretty.
60
61 Well, basically, that's it. Of course, the bar primitives, which are
62 used to draw the ``real things'' should be aware of a possibility to
63 draw them horizontally. All primitives supplied with this package work
64 this way.
65
66 To demonstrate the concept let me draw the same diagram as in
67 \figref{fig:1}, but now in the horizontal mode.
68
69 \begin{lstlisting}{}
70 \renewcommand{\bdorientation}{\bdhor}
71 \begin{figure}[t]\centering
72 \input{figs/examp1.tex}
73 \caption{\label{fig:1hor} \figref{fig:1} redrawn in the horizontal mode.}
74 \end{figure}
75 \end{lstlisting}
76
77 The result is \figref{fig:1hor}. It looks quite okay. However the same
78 trick does not work
79 with \figref{fig:4hor} (which is \figref{fig:1}
80 plus a legend) [\figref{fig:4hor}]. You need to move the legend by hand.
81
82
83 \renewcommand{\bdorientation}{\bdhor}
84 \begin{figure}[t]\centering
85 \input{figs/examp1.tex}
86 \caption{\label{fig:1hor} \figref{fig:1} redrawn in the horizontal mode.}
87 \end{figure}
88
89 \begin{figure}[t]\centering
90 \input{figs/examp1b.tex}
91 \caption{\label{fig:4hor} \figref{fig:4} redrawn in the horizontal
92 mode. As you see, the legend messes it up. Sorry, I cannot do
93 anything about it.}
94 \end{figure}
95
96 \clearpage
97 \subsection{\label{sec:4:1}Listing of the example \figref{fig4:1}}
98 \lstinputlisting{figs/examp6.tex}
99
100
101
102 \end{document}