| 1 |
\opt{text}{\skbheading{Files and Headings}} |
| 2 |
|
| 3 |
\DescribeMacro{\skbinput} |
| 4 |
\DescribeMacro{\skbheading} |
| 5 |
Just to remember: we have two different types of files in two |
| 6 |
different directory structures. The repository folder stores the |
| 7 |
content and the publish folder stores everything needed to produce |
| 8 |
complete documents. For the content in the repository, we mark headings |
| 9 |
with the macro \cmd{\skbheading}. This macro has no options and no arguments |
| 10 |
and is simply called with the text for the heading, as shown in |
| 11 |
\opt{text}{the following example.}\opt{note}{the first block on this slide.} |
| 12 |
|
| 13 |
\opt{text}{ |
| 14 |
\lstinputlisting[style=generic,language=TeX]{\skbfileroot{examples/skbheading}} |
| 15 |
} |
| 16 |
|
| 17 |
Leaving the argument empty will have the same effect as calling the original \LaTeX~ |
| 18 |
macros directly with an empty argument. |
| 19 |
|
| 20 |
The association of a \LaTeX~document level with the heading is then defined |
| 21 |
for the published documents (in the publish folder) using the macro \cmd{\skbinput}. |
| 22 |
This macro provides a number of options and requires one argument. |
| 23 |
\opt{text}{The follwing examples}\opt{note}{The second block on this slide} shows |
| 24 |
a few use cases for \cmd{\skbinput}. |
| 25 |
\opt{text}{For all possible options, please see \autoref{tab:skbinput:options}} |
| 26 |
|
| 27 |
\opt{text}{ |
| 28 |
\lstinputlisting[style=genericLN,language=TeX]{\skbfileroot{examples/skbinput}} |
| 29 |
} |
| 30 |
|
| 31 |
\opt{text}{ |
| 32 |
\begin{table}[ht!] |
| 33 |
\caption{Options for skbinput} |
| 34 |
\label{tab:skbinput:options} |
| 35 |
\begin{tabular*}{\textwidth}{ >{\small}p{.1\textwidth} >{\small}p{.40\textwidth} >{\small}p{.40\textwidth}} |
| 36 |
\toprule |
| 37 |
\textbf{Option} & \textbf{Description} & \textbf{Values} \\ |
| 38 |
\midrule |
| 39 |
\skbinput[from=rep]{manual/skbinput-opt-table} |
| 40 |
\bottomrule |
| 41 |
\end{tabular*} |
| 42 |
\end{table} |
| 43 |
} |
| 44 |
|
| 45 |
Let's start with the simpliest form, one argument only shown in line 1. |
| 46 |
The macro will look for a file called myfile.tex in the root directory of the \skbacft{A3DS:SKB}. |
| 47 |
The file extension .tex is automatically added, and since we did not specify any |
| 48 |
special directory the root directory is used instead. |
| 49 |
If the file is not found, the macro will throw an error providing the full path and filename it |
| 50 |
did try to load. |
| 51 |
|
| 52 |
Line 2 shows how we can load the file \skbem[code]{myfile.tex} from the repository folder. |
| 53 |
As you can see, the option \skbem[code]{from} is supplied with the argument \skbem[code]{rep}, |
| 54 |
which in fact directs the macro to look for \skbem[code]{myfile.tex} in the repository folder. |
| 55 |
Should the file be located in the folder for published documents, we simply change the |
| 56 |
\skbem[code]{from} option to \skbem[code]{pub} as shown in line 3. |
| 57 |
|
| 58 |
If \skbem[code]{from} is used and neither \skbem[code]{pub} nor \skbem[code]{rep} is given, the macro will trow an error. |
| 59 |
|
| 60 |
To associate a document level for the heading, we can use the option \skbem[code]{level} to define which |
| 61 |
level we want. This option understands all standard document levels from the memoir package: book, part, |
| 62 |
title, chapter, section, subsection and subsubsection. So, if we want to load myfile.tex as a chapter |
| 63 |
we simple invoke \cmd{\skbinput} as shown in line 4 of the example. |
| 64 |
|
| 65 |
Since myfile.tex is part of the repository, |
| 66 |
we combine the two options \skbem[code]{from} and \skbem[code]{level} (see line 5). |
| 67 |
This call to \cmd{\input} will load \skbem[code]{myfile.tex} from the repository and use \cmd{\chapter} for |
| 68 |
the heading found in that file. If \skbem[code]{myfile.tex} is in a sub folder, we simply add that sub folder to |
| 69 |
the filename. An example is shown in line 6 assuming the the file is located in the repository sub-folder |
| 70 |
examples. |