On Thursday 11 September 2008 08:02:34 pm Travis wrote:
> So I really like lyx for writing; I'm using it in a book which you may view
> here:
>
> http://www.subspacefield.org/security/security_concepts.html
>
> In any case, I want to be able to use lyx for editing, but have a script
> or Makefile for each project that generates PDF, HTML or both.
>
> I'm wondering if anyone else feels that manually exporting these things is
> not the Unix way and if they've cooked together some scripts or makefiles.
>
> I am well aware of lyx -e, but I've found that it chooses a convertor
> in some manner but I don't know how (the one it chooses is
> suboptimal).
You can export to LaTeX, and from there you can attack it with the converters
and utilities of your choice.
> Furthermore, I don't understand the filename.lyxConv
> convention. Therefore, I've been avoiding it.
You're doing better than I. I don't even know what the filename.lyxConv
convention is.
Anyway, the following is a script I use to compile a LyX book. It erases all
the intermediate files, exports to LaTeX, runs latex on that, then runs dvips
and ps2pdf to create the PDF. It also checks for compile errors by means of
checking the length of one of the intermediate files.
==================================================
#!/bin/bash
lyxcommand=lyx-1.5.6
rm -f $1.aux
rm -f $1.dvi
rm -f $1.ps
rm -f $1.pdf
rm -f $1.idx
rm -f $1.ilg
rm -f $1.ind
rm -f $1.log
rm -f $1.tex
rm -f $1.toc
$lyxcommand --export latex $1.lyx
latex $1.tex
makeindex $1.idx
ilglines=`wc -l $1.ilg | cut -d " " -f 1`
if test "$ilglines" = "6"; then
latex $1.tex
latex $1.tex
# Two commands below DO NOT ensure embedded fonts.
# dvips -o $1.ps $1.dvi
# ps2pdf12 $1.ps
# Two commands below ensure all fonts embedded!
dvips -t letter -Pdownload35 -o $1.ps $1.dvi
ps2pdf12 -dEmbedAllFonts=true $1.ps
#nohup gv $1.pdf &
#exit 0
else
echo ERROR: Inspect $1.ilg and $1.ind!
gvim $1.ilg $1.ind
echo ERROR: Inspect $1.ilg and $1.ind!
exit 1
fi
==================================================
As you can see, my shellscript is basically the same thing as your makefile,
except you use pdftex and I use dvips and ps2pdf. I'm not sure what benefit
you'd get out of using a makefile, because I don't see all that many
dependencies that would change what you need to do.
SteveT
>
> Also, I'm having to use a manually-compiled tth because my book
> triggered a bug (now fixed but not in ubuntu archives yet) in tth.
>
> Finally, I'm using images, and they need to be grouped with the book's
> HTML when publishing that way.
>
> I've been experimenting a bit and this is what I have, but it's suboptimal:
>
> #! /usr/bin/make
>
> LYX="lyx"
>
> STAGING="$(HOME)/save/www.subspacefield.org/security/"
>
> # $@ is target of rule
> # $< is first prerequisite
> %.tex: %.lyx
> $(LYX) -e latex $<
>
> %.pdf: %.tex
> pdflatex $<
>
> # Does not work right just yet
> %.html: %.tex
> /home/travis/me/security/tth -t -e2 $<
>
> install: $(TARGETS)
> chmod -R a+rX $^
> cp -pR $^ $(STAGING)
>
> clean:
> -bash -c 'rm
> $(PAPER).{toc,tex,snm,pdf,out,nav,log,aux,tlg,log,dvi,aux}'
>
> Anyone else trying similar tricks?