[texhax] getting embedded vs paged pdf (eps/png)

George Georgalis george at galis.org
Mon Mar 10 18:49:21 CET 2008


Hello Matthew,

On Wed, Feb 13, 2008 at 02:24:42PM -0500, Matthew Leingang wrote:
>
>On Feb 13, 2008, at 1:54 PM, George Georgalis wrote:
>
>> The subject sums up the task, not sure why I cannot find
>> anything on the topic searching for embed* and page*
>>
>> I'd like to use pdflatex generate stand alone formulas
>> and tables, ie without page layout. these will be used
>> in web pages and/or word processors; final output
>> needs be in eps or png format. Doesn't really matter
>> if pdflatex output is converted to eps/png or if they
>> are generated directly, but how can I make stand alone
>> images (eg size of the table/formula) vs typeset into
>> the paper size?
>>
>
>You might want to take a look at the preview package to extract  
>encapsulated images of environments.
>


Indeed, preview works for me!

The preview doc is difficult but did get
me enough info to produce the following
Makefile fragments... the pdf target
required some scripting to make separate
pdf files, there may be a better way...


multi :
	$(MAKE) clean
	latex '\PassOptionsToPackage{active,delayed,tightpage,displaymath,floats,textmath,graphics}{preview} \input{$@}'
	$(MAKE) png pdf file=$@
pdf :
	dvips -i -o ${file}.ps. ${file}
	for n in ${file}.ps.* ; do gs -q -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=$$n.pdf $$n ; rm $$n ; printf $$n"\t" ; done ; echo
png :
	dvips -o ${file}.ps ${file}
	gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 -dGraphicsAlphaBits=4 -dSAFER -dBATCH -dNOPAUSE -sOutputFile=${file}-\%d.png ${file}.ps
eps :
	dvips -o ${file}.ps ${file}
	gs -sDEVICE=epswrite -r2400 -dBATCH -dNOPAUSE -sOutputFile=${file}-\%d.eps ${file}.ps
clean :
	find . -type f \( -name \*.ttt -o -name \*.fff -o -name \*.lof -o -name \*.lot \) -exec rm \{\} \;
	find . -type f \( -name \*.aux -o -name \*.log -o -name \*.toc -o -name \*.out -o -name \*.idx \) -exec rm \{\} \;
	find . -type f \( -name \*.pdf -o -name \*.png -o -name \*.dvi -o -name \*.eps -o -name \*.ps  \) -exec rm \{\} \;


It is unfortunate that \usepackage{preview}
cannot be passed by the \PassOptionsToPackage
convention above. The only problem with this
method is some formula come out as multiple
images when one would be preferred... eg

\documentclass{amsart}
\usepackage[active,tightpage,displaymath,textmath,showlables,floats,graphics]{preview}
\begin{document}

\ $\binom{n}{x_1\  x_2\ \ldots x_n} \prod_{i=1}^n p_i^{x_i}$\\
\ $sum_{i=1}^n x_i = n ; 0 < p_i < 1i ; \sum_{i=1}^n p_i = 1$

\end{document}

For above, pdflatex generates two pages.
The following is one page but has two
undesirable side effects.

\begin{table}
\begin{centering}
\ $\binom{n}{x_1\  x_2\ \ldots x_n} \prod_{i=1}^n p_i^{x_i}$\\
\ $sum_{i=1}^n x_i = n ; 0 < p_i < 1i ; \sum_{i=1}^n p_i = 1$\\
\end{centering}
\end{table}

That produces floats and the preview image
is the width of the page; neither of which
are desired. Is there some way to group
these lines into one "preview" "tightpage"
image?

// George


-- 
George Georgalis, information system scientist <IXOYE><


More information about the texhax mailing list