## Automating Multi-Pass Processing with latexmk and TeXShop.

The official TeXShop Support Forum.

### Latexmk 4.18 for TeXShop Available.

Howdy,

Latexmk had been updated to version 4.18. Only minor fixes with some interpretation of a citation-error by natbib the major one.

I've also added a lualatexmk engine for working with lualatex in MacTeX(TeX Live)-2010 when it is released.

You can pick up the update as Latexmk418TeXshop.zip at <http://public.me.com/herbs2>. It comes with installation instructions and documentation along with the original latexmk release.
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Hi,

I updated to latexmk 4.18 using your file. I still get the same bug intermittently, where the preview is not updated. The bug always occurs when the following error message shows up:

Code: Select all
`For rule 'ps2pdf', running '&do_viewfile(  )' ...Collected error summary (may duplicate other messages):  bibtex main: Bibtex errors: See file 'main.blg'Latexmk: Use the -f option to force complete processing.Latexmk: All targets (main.pdf main.ps main.dvi) are up-to-date`

The content of main.blg is:

Code: Select all
`This is BibTeX, Version 0.99c (TeX Live 2009)The top-level auxiliary file: main.auxThe style file: apalike.bstA level-1 auxiliary file: Abstract.auxA level-1 auxiliary file: newgaps.auxDatabase file #1: dissertation.bibA bad cross reference---entry "link87"refers to entry "gardenfors87", which doesn't existWarning--I didn't find a database entry for "gardenfors87"Warning--empty booktitle in link87Warning--empty publisher in link87You've used 131 entries,            1935 wiz_defined-function locations,            1147 strings with 18596 characters,and the built_in function-call counts, 48238 in all, are: (...)`
champoll

Posts: 8
Joined: Wed Apr 16, 2008 5:46 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

So latexmk detected a problem with the bibtex run so it exits with an error code and TeXshop won't change the display. You need to correct the error.

(By the way, this is a different error from the files I got from you although it's still a problem with bibliography.)
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Hi,

So I realize that this is not a bug report but a feature request for your (otherwise great) Texshop integration of latexmk. If I understand you correctly, whenever latexmk exists with an error code, Texshop doesn't refresh the preview window, even if the pdf file on disk has been updated. This means that in these cases the user needs to either correct the cause of the error code, or refresh manually by closing and reopening the pdf file.

The problem is that the user might not know exactly how to fix the cause of the error code, or might not care about it at the moment because other things are more pressing, like finishing the document on a deadline. Especially when the document is large, there will often be a case when errors creep up somewhere. When these errors are nonfatal (ie when they don't abort compilation), the user should be able to ignore them for the moment, without interrupting workflow. In my specific case, I've tried many times to fix the cause of the error without success -- whenever I think it's gone, it reappears. But it doesn't bother me because it doesn't change the appearance of the document. The only problem is that it prevents the preview from refreshing when I use latexmk.

So my suggestion would be to let Texshop refresh the preview window whenever the pdf file has been changed, or alternatively whenever latexmk returns, no matter its error code. Of course there shouldn't be a refresh when the pdf file is deleted rather than changed or when it's been replaced by an empty file...
champoll

Posts: 8
Joined: Wed Apr 16, 2008 5:46 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

I think changing TeXShop's behavior in this case would be dangerous since the state of the pdf file is really unknown when an error occurs and could crash TeXShop.

I'm not sure if this will work for you (I'd change it back right after the pressure is off since a forced display of the pdf will give you the feeling that all is right with the document) but you can try to add the -f option to the latexmk engine. Open ~/Library/TeXShop/Engines/latexmk.engine in TeXShop (just double click it) and change the last line there from
Code: Select all
`"\${LTMKBIN}"/latexmk -pdfps -r "\${LTMKEDIT}/latexmkrcedit" -r "\${TSBIN}/latexmkrc" "\$1"`
to
Code: Select all
`"\${LTMKBIN}"/latexmk -f -pdfps -r "\${LTMKEDIT}/latexmkrcedit" -r "\${TSBIN}/latexmkrc" "\$1"`
(note the -f option added right after the latexmk on that line). This tells latexmk to simply not stop after the error is detected so it may finish normally. Please let me know if this works for you. Again, I think this is bad/dangerous practice.

EDIT: I just had a chance to try it and it DOESN'T bypass the problem. I'll get in touch with the author of latexmk about this but I don't know if there is a real solution since your, in this case, non-fatal error can't be distinguished from truly fatal errors. I'll ask about possible earlier detection of the error so it may be easier to see and fix although the information is on the Console.
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

I just realized that there really is a legitimate solution to your problem. Don't comment out all the other include files! After doing a compile of the complete document add the line

\includeonly{newintro}

to the preamble. This will allow all the other information to be gathered (you will get a TOC and a Bibliography) but you will not compile the other documents. This is the standard way of working on part of a distributed document without re-compiling the whole document and retain cross references, etc.
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Hi,

Yes, it seems that the core of the matter is that latexmk should allow a distinction between fatal and nonfatal errors so that latexmk-for-Texshop can then pick it up.

In the meantime, I was able to avoid the nonfatal error by following your instructions. So the problem is solved for me. Thanks again!
champoll

Posts: 8
Joined: Wed Apr 16, 2008 5:46 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

Latexmk 4.22d has been released. The main change, for those of you using the biblatex package and who want to use biber instead of bibtex as the backend bibliography processor, is that the latexmk now automatically detects if it should use biber. Seems to work fine on my testbed.

You can get the update as Latexmk422dTeXShop.zip at <http://public.me.com/herbs2>. Installation instructions come with the packaging.

EDIT: Latexmk 4.22d released. Minor bug fixes only for MikTeX (under Windows).
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

Latexmk 4.22e has been published. The main update here is for those lovers of the biblatex package who need utf-8 encoding compatibility and wish to use biber 0.7.2 as the bibliography backend instead of bibtex (or bibtex8). This version of latexmk automatically detects the need to use biber 0.7.2 rather than bibtex (or bibtex8 with a custom engine) when that option is used with the biblatex package.

You can get the updated packaging for TeXShop as Latexmk422eTeXShop.zip from <http://public.me.com/herbs2>. It comes with installation instructions.

NOTE: this is an update for using biber 0.7.2, with biblatex 1.1a, since some wording in the biber log file has changed with this version. It will also works with biber 0.7.4/biblatex 1.1b and biber 0.8/biblatex 1.2a.
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

### Re: Automating Multi-Pass Processing with latexmk and TeXSho

Howdy,

Latexmk 4.23 has been published. it contains the following changes from 4.22e:
1. Correctly parse blg files of biber 0.8.
2. Deal with problem that if maximum number of runs of (pdf)latex is exceeded, -pvc mode infinitely repeats (pdf)latex.
3. Fix problem that changes in generated files during run of (pdf)latex may not be detected if the run is shorter than the granularity of file times.
4. Corrections of comments and messages.
5. Documentation improvement.
6. Correct handling of errors given by rc files.
7. Enhancements for convenient use of latexmk with Makefiles (options -deps, -deps-out, -use-make).
8. -recorder option for improved detection of input and output files.

It is available set up for use with TeXShop as ``Latexmk423TeXshop.zip'' from <http://public.me.com/herbs2>.
Good Luck,
Herb Schulz
Herbert Schulz

Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

PreviousNext