| 1 |
\opt{text}{\skbheading{Figures}} |
| 2 |
|
| 3 |
\DescribeMacro{\skbfigure} |
| 4 |
The classic way to add figures to your document is to have a \skbacft{ISO:PDF} or \skbacft{ISO:PNG} or \skbacft{ISO:JPG} |
| 5 |
file ready, include it using \cmd{\includegraphics} while putting it into a box |
| 6 |
to resize it (i.e. to the width of the text in your document), putting this |
| 7 |
very box into a figure environment so that \LaTeX~can process list of figures etc. |
| 8 |
and of course adding lable and caption to it.% |
| 9 |
\opt{text}{% |
| 10 |
Here is some \LaTeX~example, which also uses the center environment: |
| 11 |
\lstinputlisting[style=generic,language=TeX]{\skbfileroot{examples/figure-classic}} |
| 12 |
}% |
| 13 |
\opt{note}{The first block of this slide show a \LaTeX~example, which also uses the |
| 14 |
center environment.}% |
| 15 |
|
| 16 |
With the \skbacft{A3DS:SKB} macro \cmd{\skbfigure} things become a little bit simplier. |
| 17 |
takes a number of options and one argument.% |
| 18 |
\opt{text}{The following code}\opt{note}{The second block on this slide} |
| 19 |
shows a number of examples for using this macro. |
| 20 |
|
| 21 |
\lstinputlisting[style=genericLN,language=TeX]{\skbfileroot{examples/skbfigure}} |
| 22 |
|
| 23 |
Let's start with the easy usage, simply using the one argument to load a figure, |
| 24 |
as shown in line 1. |
| 25 |
This call will simply use \cmd{\includegraphics} and \cmd{\resizebox} to load the figure |
| 26 |
\skbem[code]{myfig} from the figure directory, so we do not need to say |
| 27 |
\skbem[code]{../figures} anymore. To use the figure and the center environment, we simply |
| 28 |
add two options requesting exactly that, as shown in line 2. |
| 29 |
In other words, using the option \skbem[code]{figure} will put the \skbem[code]{myfig} in |
| 30 |
a figure environment and using the option \skbem[code]{center} will center the figure. |
| 31 |
|
| 32 |
Similar for width and height information. Say the figure should be rescaled to the width |
| 33 |
of the text in your document you simply add width to the options, as shown in line 3 |
| 34 |
Use \skbem[code]{height} for height or both options if required. Note that the width and |
| 35 |
the hight are automatically applied to the \cmd{\resizebox} and \cmd{\includegraphics}. |
| 36 |
You can also add caption and label information using the respective options (lines 4 and 5). |
| 37 |
Now we will have the same result as the classi \LaTeX~example. You can also add the |
| 38 |
required position for your figure, if using the figure environment applying the option |
| 39 |
\skbem[code]{position} with the usual paramters, including \skbem[code]{H} from the float |
| 40 |
environment. |
| 41 |
|
| 42 |
\opt{text}{ |
| 43 |
\begin{table}[ht!] |
| 44 |
\caption{Options for skbfigure} |
| 45 |
\label{tab:skbfigure:options} |
| 46 |
\begin{tabular*}{\textwidth}{ >{\small}p{.2\textwidth} >{\small}p{.75\textwidth}} |
| 47 |
\toprule |
| 48 |
\textbf{Option} & \textbf{Description} \\ |
| 49 |
\midrule |
| 50 |
\skbinput[from=rep]{manual/skbfigure-opt-table} |
| 51 |
\bottomrule |
| 52 |
\end{tabular*} |
| 53 |
\end{table} |
| 54 |
} |
| 55 |
|
| 56 |
\opt{text}{\skbinput[from=rep]{manual/figures2}} |