summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/ltximg
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-12-06 22:19:50 +0000
committerKarl Berry <karl@freefriends.org>2013-12-06 22:19:50 +0000
commit6937c88bc5eec127cd58cb4337d5351741fdf782 (patch)
tree7f03ceaaa4feccd2eec6d5d1d7908b78a0afd877 /Master/texmf-dist/doc/support/ltximg
parent3f2352dc162c0f22e60cc8a6f3deb29fb61da4da (diff)
ltximg (4dec13)
git-svn-id: svn://tug.org/texlive/trunk@32346 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/ltximg')
-rw-r--r--Master/texmf-dist/doc/support/ltximg/README45
-rw-r--r--Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdfbin0 -> 51940 bytes
-rw-r--r--Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex244
-rw-r--r--Master/texmf-dist/doc/support/ltximg/test.tex47
4 files changed, 336 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/ltximg/README b/Master/texmf-dist/doc/support/ltximg/README
new file mode 100644
index 00000000000..29e0f955e71
--- /dev/null
+++ b/Master/texmf-dist/doc/support/ltximg/README
@@ -0,0 +1,45 @@
+ltximg is a Perl script which isolates all Tikz or
+PSTricks related parts of the TeX document into single
+pdf file, split and convert in eps/pdf/png/jpg format.
+
+The advantage of "ltximg" is the ability to discuss the
+environments that give problems using the "preview" package
+as "verbatim" in line (verb|...|) or beginning with %, and
+other environments (LTXexample, Verbatim,etc).
+
+The images files are saved in a subdirectory images.
+
+Syntax: perl ltximg.pl file.tex [options]
+
+ltximg create a copy for TeX source whit all TiKZ|Pstricks environments
+ and convert all environments into single images (pdf/png/eps/jpg).
+ By default search and extract TiKZ environments using (pdf)LaTeX
+ and ghostscript (gs).
+
+Options:
+
+ --h|help - display this help and exit
+ --v|version - display version information and exit
+ --li|license - display license information and exit
+ --imageDir= - the dir for the created images (default images)
+ --d|DPI= - dots per inch for gs, pdftoppm and mogrify (default 300)
+ --IMO="..." - aditional options for mogrify need double quotes
+ --c|clear - delete all temp files
+ --xe|xetex - create all image using xelatex (tikz and pstricks)
+ --lu|luatex - create all image using lualatex (tikz)
+ --la|latex - create all image using latex (pstricks)
+ --up|useppm - create jpg and png using mogrify and ppm
+ --um|usemog - create jpg and png (transparent) using mogrify and pdf
+ --m|margins= - margins for pdfcrop (default 0)
+ --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)
+ --s|skip= - name for skip environmet in input file (default skip)
+ --o|other= - name for other export environmet (default other)
+ --a|all - create pdf/jpg/png/eps image type
+
+
+
+Pablo González 2013-01-12
diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf
new file mode 100644
index 00000000000..3d64cbf462b
--- /dev/null
+++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex
new file mode 100644
index 00000000000..9903dcf280a
--- /dev/null
+++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex
@@ -0,0 +1,244 @@
+\documentclass[11pt]{article}
+\usepackage[T1]{fontenc}%
+\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}
+
+\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}
+
+\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},
+}
+
+\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,
+}
+
+\lstset{style=mystyle1}
+\begin{document}
+\title{{\huge\textsf{lxtimg}}\\export tikz|pstricks environments to image format\\ \small v. 1.0}
+\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).
+\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.
+
+\begin{itemize}
+\item \textsf{Perl}.
+
+\item \textsf{Ghostscript}.
+
+\item \textsf{pdftops} (optional, for images in EPS format).
+
+\item \textsf{pdftoppm} (optional, for images in PPM format).
+
+\item \textsf{ImageMagick} (optional, for conversion images).
+\end{itemize}
+\newpage
+\section{Run and options}
+For \TeX Live or Mik\TeX\ users the syntax for \textsf{ltximg} script is simple:
+
+\begin{lstlisting}
+perl ltximg file.tex -options
+\end{lstlisting}
+
+
+\begin{table}[htp]
+\caption{Options for 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
+\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.
+
+\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}:
+
+\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:
+
+\begin{lstlisting}
+\begin{nopreview}
+...
+\end{nopreview}
+\end{lstlisting}
+
+and:
+\begin{enumerate}
+\item If the option is latex adds the following lines to the beginning of the test-fig.tex:
+
+\begin{lstlisting}
+\AtBeginDocument{
+\RequirePackage[active,tightpage]{preview}
+\PreviewEnvironment{pspicture}
+\PreviewEnvironment{other}}
+\end{lstlisting}
+
+\item If options its xetex adds the following lines to the beginning of the test-fig.tex:
+
+\begin{lstlisting}
+\AtBeginDocument{
+\RequirePackage[xetex,active,tightpage]{preview}
+\PreviewEnvironment{tikzpicture}
+\PreviewEnvironment{pspicture}
+\PreviewEnvironment{other}}
+\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.
+
+\begin{lstlisting}
+\AtBeginDocument{
+\RequirePackage[pdftex,active,tightpage]{preview}
+\PreviewEnvironment{tikzpicture}
+\PreviewEnvironment{other}}
+\end{lstlisting}
+
+\end{enumerate}
+
+\item Open test-tmp.tex and change the problematic words for verbatin in line or after \% symbol:
+
+\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
+\end{lstlisting}
+
+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:
+
+\begin{lstlisting}
+gs -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dBATCH -sOutputFile=imageDir/test-fig-%d.pdf \
+test-fig.pdf
+\end{lstlisting}
+and then processes the remaining options.
+
+For example, if you use the option \textsf{-pdf -um} the command behind this is:
+
+\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}
+
+
+\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}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/support/ltximg/test.tex b/Master/texmf-dist/doc/support/ltximg/test.tex
new file mode 100644
index 00000000000..32872a9ec33
--- /dev/null
+++ b/Master/texmf-dist/doc/support/ltximg/test.tex
@@ -0,0 +1,47 @@
+\documentclass{article}
+\usepackage[cmyk]{xcolor}
+\usepackage{tikz}
+\usepackage{pstricks-add}
+\begin{document}
+Text inline \verb|\begin{pspicture*} o \begin{tikzpicture} \begin{other}|
+
+\begin{tikzpicture}
+\shadedraw [shading=ball] (0,0) circle (2cm);
+\end{tikzpicture}
+
+\begin{verbatim}
+\begin{tikzpicture}
+\shadedraw [shading=ball] (0,0) circle (2cm);
+\end{tikzpicture}
+\end{verbatim}
+
+\begin{pspicture}(-0.5,-0.5)(5,3.5)
+\psset{unit=1.0cm,algebraic=true,dimen=middle,linewidth=0.8pt}
+\pscustom[linewidth=0.7pt,linecolor=red,fillcolor=red,fillstyle=solid,opacity=0.25]{
+\parametricplot{-2.39}{-1.14}{0.52*cos(t)+3.25|0.52*sin(t)+3}
+\lineto(3.25,3)\closepath}
+\pspolygon[linewidth=0.7pt,linecolor=cyan,fillcolor=green,fillstyle=solid,opacity=0.25](0.25,0.25)(3.25,3)(4.5,0.25)
+\begin{scriptsize}
+\uput[d](0.25,0.25){\red{$A$}}
+\uput[u](3.25,3){\red{$B$}}
+\uput[d](4.5,0.25){\red{$C$}}
+\uput{7pt}[-100](3.25,3){\red{$\alpha$}}
+\end{scriptsize}
+\end{pspicture}
+
+\begin{verbatim}
+\begin{pspicture}(-0.5,-0.5)(5,3.5)
+\psset{unit=1.0cm,algebraic=true,dimen=middle,linewidth=0.8pt}
+\pscustom[linewidth=0.7pt,linecolor=red,fillcolor=red,fillstyle=solid,opacity=0.25]{
+\parametricplot{-2.39}{-1.14}{0.52*cos(t)+3.25|0.52*sin(t)+3}
+\lineto(3.25,3)\closepath}
+\pspolygon[linewidth=0.7pt,linecolor=cyan,fillcolor=blue,fillstyle=solid,opacity=0.25](0.25,0.25)(3.25,3)(4.5,0.25)
+\begin{scriptsize}
+\uput[d](0.25,0.25){\red{$A$}}
+\uput[u](3.25,3){\red{$B$}}
+\uput[d](4.5,0.25){\red{$C$}}
+\uput{7pt}[-100](3.25,3){\red{$\alpha$}}
+\end{scriptsize}
+\end{pspicture}
+\end{verbatim}
+\end{document}