Re: Script to repeatedly compile a document

2016-06-27 Thread Scott Kostyshak
On Mon, Jun 27, 2016 at 08:40:51PM -0400, Steve Litt wrote:
> On Mon, 27 Jun 2016 17:12:47 -0400
> Richard Heck  wrote:
> 
> 
> > "pdf4" is simply the format name LyX uses for conversions to PDF that
> > go via xelatex. See
> > Tools> Preferences> File Handling> File Formats, then choose "PDF  
> > (XeTeX)" in the combo.
> > You'll see the label "pdf4" under "Short Name".
> 
> Confirmed! 
> 
> This is probably the greatest demonstration that this feature is
> underdocumented. Nobody could guess or blunder into that in any
> reasonable time: They'd need to know it from documentation, and I
> could find none.

$ lyx --help

-e [--export] fmt
  where fmt is the export format of choice. Look in
  Tools->Preferences->File Handling->File Formats->Short Name
  to see which parameter (which differs from the format name
  in the File->Export menu) should be passed.
  Note that the order of -e and -x switches matters.

Scott


signature.asc
Description: PGP signature


Re: Script to repeatedly compile a document

2016-06-27 Thread Steve Litt
On Sun, 26 Jun 2016 23:15:00 -0400
Scott Kostyshak  wrote:



> Why not use use the following?
> 
>   lyx --export pdf4 $mainname.lyx
> 
> It creates a PDF directly so you don't have to manually run xelatex.

Why not, indeed!

Here's another one. This script is meant to recompile and tell the user
when the compile is finished. It's intended to replace LyX's
Ctrl+Alt+R, which on my heavily modified book document class gives
wrong results (it doesn't display the varying width lines on section,
subsection and subsubsection).

So, within LyX, instead of pressing Ctrl+Alt+r, I press Ctrl+Shift+g,
which is a window manager hotkey to run the following script:

===

#!/bin/sh

mainname=ch20

cd /d/at/books/manager_utp

inform_begin () {
msg="I_hear_you:_$1"
cmd="zenity --info --timeout=2 --text=$msg"
### Run I hear you message in bg so process runs immediately
$cmd &
}

inform_success () {
msg="PDF_file_$1_has_been_rebuilt"
cmd="zenity --info --timeout=5 --text=$msg"
$cmd
}

inform_failure () {
msg="FAILURE_FAILURE_FAILURE!!!_Rebuild_of_PDF_file_$1_failed"
cmd="zenity --warning --timeout=60 --text=$msg"
$cmd
}

inform_begin   $mainname.pdf
rm $mainname.tex
rm $mainname.aux
rm $mainname.pdf
rm $mainname.log
rm $mainname.dvi
lyx --export pdf4 $mainname.lyx
#lyx --export pdf5 $mainname.lyx
if [ -f $mainname.pdf ]; then
inform_success $mainname.pdf
else
inform_failure $mainname.pdf
fi

===

You'll note the export to PDF4, which, you're right, is MUCH faster
than the alternatives, but still gives a correctly formatted PDF.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb


Re: Script to repeatedly compile a document

2016-06-27 Thread Steve Litt
On Mon, 27 Jun 2016 17:12:47 -0400
Richard Heck  wrote:


> "pdf4" is simply the format name LyX uses for conversions to PDF that
> go via xelatex. See
> Tools> Preferences> File Handling> File Formats, then choose "PDF  
> (XeTeX)" in the combo.
> You'll see the label "pdf4" under "Short Name".

Confirmed! 

This is probably the greatest demonstration that this feature is
underdocumented. Nobody could guess or blunder into that in any
reasonable time: They'd need to know it from documentation, and I
could find none.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb


Re: Script to repeatedly compile a document

2016-06-27 Thread Richard Heck
On 06/27/2016 01:35 PM, Steve Litt wrote:
> On Sun, 26 Jun 2016 23:15:00 -0400
> Scott Kostyshak  wrote:
>
>> There are reasons to compile yourself (e.g. to make a substitution)
>> but unless you have a reason, LyX is better to use because it knows
>> how many times you must run xelatex (if you only run it once, you
>> might not have the table of contents, or citations).
>
> Yeah, I knew once upon a time that I have to have multiple invocations
> of xelatex.
>
> A big old web search failed to find anything first page for lyx+"pdf4".
> Without more documentation I think I'll go with the old standby xelatex
> for building books emailed to customers.
>
> But for quick and dirty viewing, I'll indeed use pdf4. Pdf4 is *much*
> quicker, especially if one uses multiple calls to xelatex, which one
> must if TOC or index. Thanks!

"pdf4" is simply the format name LyX uses for conversions to PDF that go
via xelatex. See
Tools> Preferences> File Handling> File Formats, then choose "PDF
(XeTeX)" in the combo.
You'll see the label "pdf4" under "Short Name".

Richard



Re: Script to repeatedly compile a document

2016-06-27 Thread Steve Litt
On Sun, 26 Jun 2016 23:15:00 -0400
Scott Kostyshak  wrote:

> On Sun, Jun 26, 2016 at 10:57:22PM -0400, Steve Litt wrote:
> > Hi all,
> > 
> > The following is a script to repeatedly compile a LyX document
> > that's under construction or debugging:
> > 
> > ==
> > #!/bin/sh
> > 
> > mainname=ch20
> > 
> > flagg=a
> > 
> > while [ "$flagg" != "q" ]; do
> > rm $mainname.tex
> > rm $mainname.aux
> > rm $mainname.pdf
> > rm $mainname.log
> > rm $mainname.dvi
> > lyx --export xetex $mainname.lyx  
> 
> Why not use use the following?
> 
>   lyx --export pdf4 $mainname.lyx
> 
> It creates a PDF directly so you don't have to manually run xelatex.

Confirmed!

> 
> There are reasons to compile yourself (e.g. to make a substitution)
> but unless you have a reason, LyX is better to use because it knows
> how many times you must run xelatex (if you only run it once, you
> might not have the table of contents, or citations).

Yeah, I knew once upon a time that I have to have multiple invocations
of xelatex.

A big old web search failed to find anything first page for lyx+"pdf4".
Without more documentation I think I'll go with the old standby xelatex
for building books emailed to customers.

But for quick and dirty viewing, I'll indeed use pdf4. Pdf4 is *much*
quicker, especially if one uses multiple calls to xelatex, which one
must if TOC or index. Thanks!

> 
> > Notice that this script uses --export xetex and xelatex. This is so
> > you can compile documents that use non-TeX fonts. There's also a
> > way to do it with LuaTeX, but I don't know it.  
> 
> If you want a LuaTeX PDF, just use pdf5 for the format.

Confirmed!

Everyone should consider using --export pdf4 or --export pdf5. It would
also be great if people could supply links to authoritative
documentation on these two exports.
 
SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb


Re: Script to repeatedly compile a document

2016-06-26 Thread Scott Kostyshak
On Sun, Jun 26, 2016 at 10:57:22PM -0400, Steve Litt wrote:
> Hi all,
> 
> The following is a script to repeatedly compile a LyX document that's
> under construction or debugging:
> 
> ==
> #!/bin/sh
> 
> mainname=ch20
> 
> flagg=a
> 
> while [ "$flagg" != "q" ]; do
>   rm $mainname.tex
>   rm $mainname.aux
>   rm $mainname.pdf
>   rm $mainname.log
>   rm $mainname.dvi
>   lyx --export xetex $mainname.lyx

Why not use use the following?

  lyx --export pdf4 $mainname.lyx

It creates a PDF directly so you don't have to manually run xelatex.

There are reasons to compile yourself (e.g. to make a substitution) but
unless you have a reason, LyX is better to use because it knows how many
times you must run xelatex (if you only run it once, you might not have
the table of contents, or citations).

> Notice that this script uses --export xetex and xelatex. This is so you
> can compile documents that use non-TeX fonts. There's also a way to do
> it with LuaTeX, but I don't know it.

If you want a LuaTeX PDF, just use pdf5 for the format.

> This script uses mupdf to view the finished PDF. Since discovering
> mupdf, I've configured LyX to use it as LyX's exclusive PDF reader.
> It's lightning fast

Agreed, very fast.

Nice script, Steve. Thanks for sharing it with the list!

Scott


signature.asc
Description: PGP signature