| 1 |
% !TEX root = texblend-doc.tex |
| 2 |
% !TEX TS-program = lualatex |
| 3 |
\section{Usage} |
| 4 |
|
| 5 |
The basic usage of \TeX Blend is as follows: |
| 6 |
|
| 7 |
\begin{verbatim} |
| 8 |
$ texblend chapter.tex |
| 9 |
\end{verbatim} |
| 10 |
|
| 11 |
This command combines the text from the document \texttt{chapter.tex} with the preamble |
| 12 |
from the main document specified in the root directive and directly compiles |
| 13 |
the resulting document. The output will be saved as \texttt{chapter.pdf}. |
| 14 |
|
| 15 |
\subsection{Command Line Options} |
| 16 |
|
| 17 |
TeXBlend supports a variety of command-line options: |
| 18 |
|
| 19 |
\begin{verbatim} |
| 20 |
texblend [options] filename |
| 21 |
|
| 22 |
Available options: |
| 23 |
-e,--expand Expand variables in the template |
| 24 |
-h,--help Print the help message |
| 25 |
-H,--HTML Compile to HTML using TeX4ht |
| 26 |
-l,--lualatex Select lualatex as compiler |
| 27 |
-o,--output (default "") Set the output file name |
| 28 |
-O,--texoptions (default "") Extra options that should be passed |
| 29 |
to the LaTeX compiler |
| 30 |
-p,--pdflatex Select pdflatex as compiler |
| 31 |
-P,--print Don't compile the document, |
| 32 |
print the expanded template instead |
| 33 |
-s,--shell-escape Enable execution of external |
| 34 |
commands in LaTeX |
| 35 |
-t,--template (default "") Use explicit template instead of |
| 36 |
the one provided in the input file |
| 37 |
-v,--version Print version info |
| 38 |
-x,--xelatex Select xelatex as compiler |
| 39 |
<filename> (string) Use "-" if you want to pass |
| 40 |
document from the standard input |
| 41 |
\end{verbatim} |
| 42 |
|
| 43 |
You can join multiple short options, for example the following call uses separate short options: |
| 44 |
|
| 45 |
\begin{verbatim} |
| 46 |
$ texblend -e -l -o test chapter.tex |
| 47 |
\end{verbatim} |
| 48 |
|
| 49 |
It can be shortened to this form: |
| 50 |
|
| 51 |
\begin{verbatim} |
| 52 |
$ texblend -elo test chapter.tex |
| 53 |
\end{verbatim} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
\subsection{Compilation Options} |
| 58 |
|
| 59 |
You can override the \verb'program' directive, which specifies the \LaTeX\ engine |
| 60 |
used, with one of the options \verb|--lualatex|, \verb|--xelatex|, or \verb|--pdflatex|. |
| 61 |
The default program used when the document lacks a \verb'program' directive and none of these |
| 62 |
options is used is \verb|pdflatex|. |
| 63 |
|
| 64 |
If the document uses external commands, such as with the Minted or Imakeidx |
| 65 |
packages, you can utilize the \verb|--shell-escape| option. |
| 66 |
|
| 67 |
You can specify additional options for the LaTeX compiler using the \verb|--texoptions| option. |
| 68 |
|
| 69 |
Instead of compiling, you can print the assembled document to standard output |
| 70 |
using the option \verb|--print|. |
| 71 |
|
| 72 |
To change name of the generated PDF file, use the \verb|--output| option. |
| 73 |
|
| 74 |
|
| 75 |
\subsection{Usage of Templates} |
| 76 |
|
| 77 |
|
| 78 |
Instead of the main document specified in the \verb'root' directive, you can use |
| 79 |
another document as a template, chosen using the \verb|--template| option. You |
| 80 |
can use the entire file path or simply specify the file name, making use of the |
| 81 |
\verb'kpsewhich' command (see section~\ref{sec:placement}) to locate the file. |
| 82 |
|
| 83 |
If you are using variables in the template (see section~\ref{sec:variables}), use the |
| 84 |
\verb'--expand' option to expand them with the values specified in the document's |
| 85 |
directives. |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
\subsection{HTML Support} |
| 91 |
|
| 92 |
\TeX Blend supports direct export to HTML using \TeX4ht. A note regarding the |
| 93 |
\verb|--texoptions| command line option: you can utilize this option to pass all |
| 94 |
command-line arguments to \verb|make4ht|. Ensure to include the \verb|-| character in place |
| 95 |
of the filename for proper execution. |
| 96 |
|
| 97 |
For example, if you want to use the \verb|fn-in| option for endnotes, use the following command: |
| 98 |
|
| 99 |
\begin{verbatim} |
| 100 |
$ texblend -HO '- "fn-in"' chapter.tex |
| 101 |
\end{verbatim} |
| 102 |
|
| 103 |
If you want to use a configuration file in addition, you will need this command: |
| 104 |
|
| 105 |
\begin{verbatim} |
| 106 |
$ texblend -HO '-c config.cfg - "fn-in"' chapter.tex |
| 107 |
\end{verbatim} |