diff options
Diffstat (limited to 'Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex')
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex | 427 |
1 files changed, 260 insertions, 167 deletions
diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex index 9903dcf280a..cfe90a9d057 100644 --- a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex +++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex @@ -1,244 +1,337 @@ -\documentclass[11pt]{article} +\documentclass[10pt]{article} \usepackage[T1]{fontenc}% +\usepackage{hologo}% +\usepackage{fetamont}% \usepackage{libertine}% \usepackage{booktabs}% \usepackage{tabularx}% -\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} -\usepackage[margin=0.85in,letterpaper]{geometry} -\usepackage[scaled=0.9]{inconsolata} -\usepackage{listings} - +\usepackage{tcolorbox}% +\tcbuselibrary{documentation}% +\usepackage[margin=1.0in,letterpaper]{geometry}% +\usepackage[scaled=0.9]{inconsolata}% +\usepackage{listings}% +% colors \definecolor{lightgrey}{rgb}{0.9,0.9,0.9} \definecolor{darkgreen}{rgb}{0,0.6,0} \definecolor{darkred}{rgb}{0.6,0,0} \definecolor{myblue}{RGB}{20,105,176} \definecolor{darkgreen}{rgb}{0,0.6,0} - +% languaje \lstdefinelanguage{mytex}[LaTeX]{TeX}{ - columns=flexible, - frame=single, - framerule=0pt,% - backgroundcolor=\color{gray!10},% - xleftmargin=\fboxsep,% - xrightmargin=\fboxsep, - alsoletter={\\,*,\&}, - morekeywords={\\AtBeginDocument, - \\RequirePackage, - \\PreviewEnvironment, - \&}, - morekeywords=[2]{pspicture, - verbatim, - table, - other, - tikzpicture, - postscript, - preview, - TRICKS, - POSTRICKS, - TIKZPICTURE, - OTHER, - nopreview}, - morekeywords=[3]{\\begin, - \\pspicture, - \\TRICKS, - \\ENDTRICKS, - \\endpspicture, - \\end}, - literate=*{\{}{{\textcolor{myblue}{\{}}}{1} - {\}}{{\textcolor{myblue}{\}}}}{1} - {[}{{\textcolor{myblue}{[}}}{1} - {]}{{\textcolor{myblue}{]}}}{1}, -} - +columns=flexible, +frame=single, +framerule=0pt,% +backgroundcolor=\color{gray!10},% +xleftmargin=\fboxsep,% +xrightmargin=\fboxsep, +alsoletter={\\,*,\&}, +morekeywords={\\AtBeginDocument, + \\RequirePackage, + \\PreviewEnvironment, + \&}, +morekeywords=[2]{pspicture, + verbatim, + table, + other, + tikzpicture, + postscript, + preview, + TRICKS, + POSTRICKS, + TIKZPICTURE, + OTHER, + nopreview}, +morekeywords=[3]{\\begin, + \\pspicture, + \\TRICKS, + \\ENDTRICKS, + \\endpspicture, + \\end}, +literate=*{\{}{{\textcolor{myblue}{\{}}}{1} + {\}}{{\textcolor{myblue}{\}}}}{1} + {[}{{\textcolor{myblue}{[}}}{1} + {]}{{\textcolor{myblue}{]}}}{1}, + } \lstset{language=mytex} \lstdefinestyle{mystyle1}{ - basicstyle=\small\ttfamily, - keywordstyle=\bfseries\color{red}, - keywordstyle=[2]{\color{magenta}}, - keywordstyle=[3]{\color{blue}}, - commentstyle=\color{darkgreen}, - stringstyle=\color{orange}, - identifierstyle=\ttfamily, - showstringspaces=true, - breaklines=true, - tabsize=4, - columns=fullflexible, - keepspaces=true, -} - + basicstyle=\small\ttfamily, + keywordstyle=\bfseries\color{red}, + keywordstyle=[2]{\color{magenta}}, + keywordstyle=[3]{\color{blue}}, + commentstyle=\color{darkgreen}, + stringstyle=\color{orange}, + identifierstyle=\ttfamily, + showstringspaces=true, + breaklines=true, + tabsize=4, + columns=fullflexible, + keepspaces=true, + } +% style \lstset{style=mystyle1} \begin{document} -\title{{\huge\textsf{lxtimg}}\\export tikz|pstricks environments to image format\\ \small v. 1.0} +\title{{\Huge\textffm{LTX}\textffmw{img} \normalsize \Large\textffmw{v1.1}}\\\small\textffm{tikz|pgf|pstricks \\to image format}} \author{Pablo Gonz\'{a}lez Luengo\\ \small \ttfamily pablgonz at yahoo dot com} \date{\today} \maketitle \begin{abstract} \noindent -\textsf{ltximg}\footnote{Thanks to Giuseppe Matarazzo for his kind help on testing the script.} is a \textsf{Perl} script that automates the process to export \textsf{tikzpicture} or \textsf{pspicture} environments to image formats (PDF, EPS, PPM, PNG). +\textsf{ltximg} is a \textsf{Perl} script that automates the process to extract and convert all PGF|TiKZ|Pstricks environments from input file to image formats (pdf,png,jpg,eps,ppm,svg) and source code for environments in individual files using \textsf{Ghostscript} and other software. By default search and extract environments using \hologo{pdfLaTeX}. \end{abstract} \tableofcontents \section{Required Software} -For the full operation of the script you need the following opensource programs -(available for windows and linux), external to \textsc{ctan} repositories. +For the full operation of the \textsf{ltximg} script you need the following opensource programs +(available for windows and linux). \begin{itemize} -\item \textsf{Perl}. +\item \textsf{Perl} (version 5.18 or higer). -\item \textsf{Ghostscript}. +\item \textsf{Ghostscript} (version 9.16). -\item \textsf{pdftops} (optional, for images in EPS format). +\item \textsf{pdftops} (optional, for images in \textsf{EPS} format). -\item \textsf{pdftoppm} (optional, for images in PPM format). +\item \textsf{pdftoppm} (optional, for images in \textsf{PPM} format). -\item \textsf{ImageMagick} (optional, for conversion images). +\item \textsf{pdf2svg} (optional, for images in \textsf{SVG} format). \end{itemize} \newpage \section{Run and options} -For \TeX Live or Mik\TeX\ users the syntax for \textsf{ltximg} script is simple: - +the syntax for \textsf{ltximg} script is simple: +\noindent +For \TeX Live users: \begin{lstlisting} -perl ltximg file.tex -options +ltximg file.tex --options +\end{lstlisting} +For Mik\TeX\ users: +\begin{lstlisting} +perl ltximg file.tex --miktex --options \end{lstlisting} - \begin{table}[htp] -\caption{Options for ltximg} +\caption{Options for \textsf{ltximg}} \begin{tabularx}{\linewidth}{@{}>{\ttfamily} l>{\ttfamily} l >{\ttfamily}l X @{}}\\\toprule -\emph{name} & \emph{short} & \emph{default} & \emph{description}\\\midrule ---help & --h & & display help information and exit.\\ ---version & --v & & display version information and exit.\\ ---license & --li & & display license information and exit.\\ ---imageDir= & & images & The dir for the created images.\\ ---DPI= & --d & 300 & Dots per inch for gs, pdftoppm and mogrify.\\ ---IMO="..." & & & Aditional options for mogrify (need double quotes).\\ ---clear & --c & & Delete all temp files.\\ ---xetex & --xe & & Create all image using xelatex (tikz and pstricks).\\ ---luatex & --lu & & Create all image using lualatex (tikz).\\ ---latex & --la & & Create all image using latex(pstricks).\\ ---useppm & --up & & Create jpg and png using mogrify and ppm\\ ---usemog & --um & & Create jpg and png (transparent) using mogrify and pdf\\ ---margins= & --m & 0 & Margins for pdfcrop.\\ ---pdf & & & Create .pdf files using gs.\\ ---ppm & & & Create .ppm files (need pdftoppm).\\ ---eps & & & Create .eps files (need pdftops).\\ ---jpg & & & Create .jpg files (deafult use gs).\\ ---png & & & Create .png files (deafult use gs).\\ ---skip= & --s & skip & Name for skip environmet in input file.\\ ---other= & --o & other & Name for other export environmet.\\ ---all & --a & & Create pdf/jpg/png/eps image type.\\ -\bottomrule +\emph{short} & \emph{long} & \emph{default} & \emph{description}\\\midrule + -h &--help & & Display help from command line and exit.\\ + -l &--license & & Display license information and exit.\\ + -v &--version & 1.1 & Display version of script and exit.\\ + -d &--dpi=<int> & 150 & The dots per inch for images.\\ + -j &--jpg & & Create \textsf{.jpg} files (need \textsf{Ghostscript}).\\ + -p &--png & & Create \textsf{.png}files (need \textsf{Ghostscript}).\\ + -e &--eps & & Create \textsf{.eps} files (need \textsf{pdftops}).\\ + -s &--svg & & Create \textsf{.svg} files (need \textsf{pdf2svg}).\\ + -P &--ppm & & Create \textsf{.ppm} files (need \textsf{pdftoppm}).\\ + -a &--all & & Create \textsf{.(pdf,eps,jpg,png)} images.\\ + -c &--clear & & Delete all temp and aux files.\\ + -o &--output & & Create a \textsf{file-out.tex} whitout \textsf{PGF|TiKZ|PST} code.\\ + -m &--margins=<int>& 0 & Margins in bp for \textsf{pdfcrop}.\\ + -np &--nopreview & off & Create images files whitout \textsf{preview} package.\\ + -ns &--nosource & off & Delete all source for images files\\ + &--miktex &-shell-escape & Use \textsf{--enable-write18} for \hologo{MiKTeX} users.\\ + &--xetex & off & Using \hologo{XeLaTeX} for create images.\\ + &--latex & off & Using \hologo{LaTeX} for create images.\\ + &--luatex & off & Using \hologo{LuaLaTeX} for create images.\\ + &--nopdf & off & Don't create a PDF image files.\\ + &--other=<string> & other & Search \textsf{other} environment for export.\\ + &--ignore=<string> & ignore& Skip verbatim environment.\\ + &--imgdir=<string> & images & The folder for images.\\ + \bottomrule \end{tabularx} \end{table} + + \section{How it works} -The script works in two steps, but giving the same result, a new file -\emph{without tikzpicture} environments and a folder with the images from -these environments. +The script works in two steps for create image, source code and output file \emph{without PGF/TIKZ/PST} environments. + + +\subsection{Environment Suports} + +\textsf{ltximg} export and convert this environment: + +\begin{minipage}[c]{0.25\columnwidth}
+\begin{docEnvironment}% +{pspicture}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{pspicture*}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{postscript}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{circuitikz}% +{} +\end{docEnvironment} +\end{minipage} + +\vspace{0.5cm} + +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{tikzpicture}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{pgfpicture}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{ganttchart}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{forest}% +{} +\end{docEnvironment} +\end{minipage} +\vspace{0.5cm} + +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{tikzcd}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{circuitikz}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{dependency}% +{} +\end{docEnvironment} +\end{minipage} +\begin{minipage}[c]{0.25\columnwidth} +\begin{docEnvironment}% +{other}% +{} +\end{docEnvironment} +\end{minipage} + + \subsection{Comment and ignore} -The first step \textsf{ltximg } script create a image dir calls \textsf{images} -and create a copy for in file, processing is as follows, being assumed that our file is \texttt{test.tex}: +The first step \textsf{ltximg } script create a image dir (\textsf{images/}) +and read all input file in memory, processing is as follows, being assumed that our file is \texttt{test.tex}: \begin{enumerate} -\item Create a copy file called test-tmp.tex and put the problematic environments (verbatim, verbatim\*, lstlisting, - LTXexample, Verbatim, comment, alltt, minted, tcblisting, xcomment and skip) inside the: +\item Create a copy file in memory and change problematic environments (verbatim, verbatim\*, lstlisting, + LTXexample, Verbatim, comment, alltt, minted, tcblisting, xcomment and ignore) + +\item Change problematic inline verbatim from varius package (lstlisting,LTXexample, Verbatim, comment, alltt, minted, tcblisting, etc) include line whit \%. +\end{enumerate} -\begin{lstlisting} -\begin{nopreview} -... -\end{nopreview} -\end{lstlisting} -and: + +\subsection{Create source and images} \begin{enumerate} -\item If the option is latex adds the following lines to the beginning of the test-fig.tex: + +\item If script is call whitout \textsf{--nopreview} option (default), adds the following lines to the beginning of the test.tex in memory and save file test-fig.tex in images dir : \begin{lstlisting} \AtBeginDocument{ \RequirePackage[active,tightpage]{preview} -\PreviewEnvironment{pspicture} -\PreviewEnvironment{other}} +\renewcommand\PreviewBbAdjust{-60pt -60pt 60pt 60pt}% +\newenvironment{postscript}{}{}% +\PreviewEnvironment{postscript}}% \end{lstlisting} -\item If options its xetex adds the following lines to the beginning of the test-fig.tex: +\item If script is call whit \textsf{--nopreview} option, all environment code its put inside the : \begin{lstlisting} -\AtBeginDocument{ -\RequirePackage[xetex,active,tightpage]{preview} -\PreviewEnvironment{tikzpicture} -\PreviewEnvironment{pspicture} -\PreviewEnvironment{other}} +\begin{postscript} +... +\end{postscript} \end{lstlisting} -\item And if no option is given, adds the following lines at the beginning of the test-fig.tex. This is the default for -lualatex and pdflatex. +and separate in individual files (test-fig-1.tex, test-fig-2.tex, etc) in image dir and join in test-fig.tex. The postscript environment can be used to place any material to be exported if that is not supported or fails the \textsf{--other} option. -\begin{lstlisting} -\AtBeginDocument{ -\RequirePackage[pdftex,active,tightpage]{preview} -\PreviewEnvironment{tikzpicture} -\PreviewEnvironment{other}} -\end{lstlisting} +\item Now, the script call (pdf/lua/xe)latex in \texttt{test-fig.tex} and \textsf{pdfcrop} in +\texttt{test-fig.pdf} and create image files. \end{enumerate} -\item Open test-tmp.tex and change the problematic words for verbatin in line or after \% symbol: - +\section{Example} \begin{lstlisting} -\pspicture => \TRICKS -\endpspicture => \ENDTRICKS -\begin{pspicture => \begin{TRICKS -\end{pspicture => \end{TRICKS -\begin{postscript} => \begin{POSTRICKS} -\end{postscript} => \end{POSTRICKS} -\begin{tikzpicture => \begin{TIKZPICTURE -\end{tikzpicture => \end{TIKZPICTURE -\begin{other => \begin{OTHER -\end{other => \end{OTHER +ltximg test.tex -e -p -j -c -o --imgdir=pics \end{lstlisting} +produce test-out.tex whitout PGF|TiKZ|PST environments and create "pics" dir whit all images (pdf,eps,png,jpg) and source (.tex) for all related parts using \hologo{pdfLaTeX} whit preview package and cleaning all tmp files. -and save file called test-fig.tex then runs (pdf/lua/xe)latex in \texttt{test-fig.tex} and \textsf{pdfcrop} in -\texttt{test-fig.pdf}. -\end{enumerate} -\subsection{Split and convert} -If \textsf{ltximg} called with option \textsf{-pdf} or \textsf{-eps} or \textsf{-um} the file \texttt{test-fig.pdf} -is splitting in \texttt{test-fig-1.pdf, test-fig-2.pdf,\ldots} and puts them into \texttt{images} dir. The invoked behind this command is: - +\noindent +Suport bundling for short options: \begin{lstlisting} -gs -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dBATCH -sOutputFile=imageDir/test-fig-%d.pdf \ -test-fig.pdf +ltximg test.tex -epjco --imgdir=pics \end{lstlisting} -and then processes the remaining options. - -For example, if you use the option \textsf{-pdf -um} the command behind this is: +\end{document} -\begin{lstlisting} -mogrify -define png:format=png32 -define png:compression-filter=4 -quality 100 -transparent white \ --density 300 -format png *.pdf -\end{lstlisting} -And if you use the option \textsf{-pdf -up} the command behind this is: -\begin{lstlisting} -mogrify -quality 100 -define png:format=png32 -define png:compression-filter=4 -density 300 \ --format png *.ppm -\end{lstlisting} +LTXimg extract and convert all PGF|TiKZ|Pstricks environments from TeX + source into single images files (pdf/png/eps/jpg/svg) using Ghostscript. + By default search and extract environments using (pdf)LaTeX. +Environments suports by LTXimg: -\section{Creating other images format} -If you need to create other image formats we first need to generate the PPM format or PDF, then the procedure is simple -using the \textsf{ImageMagick} \texttt{convert} command, command usage is so: -\begin{lstlisting} -mogrify -format ext *.ppm -\end{lstlisting} -for TIFF use -\begin{lstlisting} -mogrify -format tiff *.ppm -\end{lstlisting} + pspicture tikzpicture pgfpicture forest ganttchart + tikzcd circuitikz dependency other postscript -\end{document}
\ No newline at end of file +Options: +\begin{tabularx}{\linewidth}{@{}>{\ttfamily} l>{\ttfamily} l >{\ttfamily}l X @{}}\\\toprule +\emph{short} & \emph{name} & \emph{default} & \emph{description}\\\midrule + -h&--help & &display this help and exit + -l&--license & &- display license information and exit + -v&--version & & - display version (current 1.2) and exit + -d&--dpi=<int> & 150 & - the dots per inch for images + -j&--jpg & &- create .jpg files (need Ghostscript) + -p&--png & &- create .png files (need Ghostscript) + -e&--eps & &- create .eps files (need pdftops) + -s&--svg & &- create .svg files (need pdf2svg) + -P&--ppm & &- create .ppm files (need pdftoppm) + -a&--all & &- create .(pdf,eps,jpg,png) images + -c&--clear & &- delete all temp and aux files + -o&--output & &- create a file-out.tex whitout PGF|TiKZ|PST code + -m&--margins=<int>& &- margins in bp for pdfcrop (default 0) + -np&--nopreview & &- create images files whitout preview package + -ns&--nosource & &- delete all source for images files + &--miktex & &- use --enable-write18 for MikTeX users + &--xetex & &- using (Xe)LaTeX for create images + &--latex & &- using LaTeX for create images + &--luatex & &- using (Lua)LaTeX for create images + &--nopdf & &- don't create a PDF image files (default off) + &--other=<string> & &- search other environment (default other) + &--ignore=<string> & &- skip verbatim environment (default ignore) + &--imgdir=<string> & &- the folder for images (default images) + \bottomrule +\end{tabularx} + + +Example: +* ltximg test.tex -e -p -j -c -o --imgdir=pics +* produce test-out.tex whitout PGF|TiKZ|PST environments and create "pics" +* dir whit all images (pdf,eps,png,jpg) and source (.tex) for all related +* parts using (pdf)LaTeX whit preview package and cleaning all tmp files. +* Suport bundling for short options: ltximg test.tex -epjco --imgdir=pics +END_OF_USAGE |