Systemcall::startscript returns the exit code of the LaTeX command
that is run, but the return value was not being checked by
LaTeX::run. Instead, we relied on parsing log files. However, this
parsing is not perfect.
The return value is now checked and if the exit code of the command
is non-zero, an enum value is added to the return and the user is
notified of the error.
At a higher level, if the LaTeX command returns a non-zero exit code,
in the GUI a message such as
"Error while exporting format: PDF (LuaTeX)" will be given instead of
"Successful preview of format: PDF (LuaTeX)".
When run on the commandline, lyx -e lualatex example.lyx
will give "Error: LaTeX failed" and a non-zero exit code
where before it gave a zero exit code.
A real example of the bug this commit fixes is LyX's (as of this commit)
ACM-sigplan.lyx template.
Before this commit:
$ lyx -e pdf2 ACM-sigplan.lyx
[...snip...]
support/Systemcall.cpp (288): Systemcall: 'pdflatex "ACM-sigplan.tex"'
finished with exit code 1
$ echo $?
0
Starting with this commit:
$ mylyx master -e pdf2 ACM-sigplan.lyx
support/Systemcall.cpp (288): Systemcall: 'pdflatex "ACM-sigplan.tex"'
finished with exit code 1
Error: LaTeX failed
----------------------------------------
LaTeX did not run successfully. The command that was run exited with
error.
$ echo $?
1
This commit solves two issues:
(1) A PDF from a previous run could have been the result of a command
that exited with error (e.g. sometimes pdflatex still produces a PDF if
it exits with error). If the "View" button were clicked a second time
without changing the .lyx file, then the checksum of the .tex file would
not have changed so LyX would show the PDF (which was created from the
first run that exited with error), and this time LyX would not report
the error (because the parsing of the logs only happens when the .tex
file is compiled).
(2) A myfile.tex that results in no output does not yield a myfile.pdf.
Thus, Any myfile.pdf in the temporary directory will not be overwritten.
Before this commit, the following scenario was possible: LyX runs
pdflatex which processes myfile.tex and no error is given so LyX opens
myfile.pdf. However, it could have been the scenario that pdflatex did
not exit with error and did not create myfile.pdf, in which case
whichever myfile.pdf is being shown is not correct. To see this bug in
action, start a new document, type "abc", view the PDF, delete "abc",
view the PDF (this correctly gives an error that empty output was
created), view the PDF again (this does not give an error because the
checksum has not changed). The PDF shown will contain "abc".
Note that the above also applies to DVI files and that the fix is
general.
The assignment name = sub.str(1) reads from the first argument given to
regex_match(), but previously this was a temporary object which was already
out of scope. This did probably not matter much in practice, but invoked
undefined behaviour, and as we all know this is allowed ton format your hard
disk or kill to your cat, so better fix this.
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.
I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
- achicago
- apacite
- apalike
- astron
- authordate
- chicago
- harvard
- mslapa
- named
This allows these citation packages can be Required by the document layout.
LyX handles the package ordering, loading any of these packages before natbib
when both are required by the document layout. For example, apacite can be
used with or without natbib.
The package achicago isn't compatible with natbib out-of-the-box,
but the following compatibility code makes it work:
\usepackage{achicago}
\let\achicagobib\thebibliography
\usepackage[authoryear]{natbib}
\let\thebibliography\achicagobib
\let\UnexpandableProtect\protect
\let\SCcite\astroncite
Filenames embraced in <...> can occur anywhere on the line and multiple times. This fixes for me the case that graphics included via ERT were not tracked. It probably also fixes#8336.
This is a candidate for branch.
variable. This is done in the preferences, much like as the PATH prefix.
A single '.' in the paths will get replaced with the current document dir
and also non-absolute paths will be prefixed with that dir.
The default semantics of TEXINPUTS apply, such that, for example, if a
path is terminated with a double slash, all subdirectories will be also
searched by both the TeX engine and ancillary programs such as dvi
previewers or dvips. As an example, if the prefix is set to ".:figs", the
TEXINPUTS variable will be set as ".:<docdir>:<docdir>/figs:$ORIGTEXINPUTS",
where <docdir> is the document directory.
The initial '.' is necessary to address the actual current dir (this will
be the temp dir at preview time), while if TEXINPUTS was initially unset,
such that $ORIGTEXINPUTS is empty, a colon (or semicolon on Windows) will
end the path list. This is very important, because we don't want to replace
the system directories but to complement them and, in order to do that, an
empty element has to be present in the list. Indeed, according to the
TEXINPUTS semantics, an empty element means the standard search path.
This works whether TEXINPUTS is originally set or not, because if the
original TEXINPUTS starts with a colon (meaning that the standard search
path is wanted there) we will have an empty element at that point,
otherwise the final colon will simply serve as a path separator.
Of course, on Windows a ';' has to be used as a path separator. LyX will
take care of transforming the platform path list into one understandable
by the TeX engine. For example, this will be the case for a Cygwin version
of LyX using a native Windows TeX engine or viceversa. I tested all of
this and it works for me.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38681 a592a061-630c-0410-9148-cb99ea01b6c8
- refine biber support: parse blg file to get the bib file into the dependency table with biber.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37581 a592a061-630c-0410-9148-cb99ea01b6c8
- fix regex so that rexeg_search finds more than one match in a line.
This fixes a bug where files which were output in the log file in a
line which already listed another file were not dependency tracked.
I.e., cases such as
(./child1.tex) (./child2.tex)
(bug 6024).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30198 a592a061-630c-0410-9148-cb99ea01b6c8
from the standard LaTeX programs.
These programs are only used now if the document actually uses Japanese, not always if they are found.
(bug 5601 a.o.).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29238 a592a061-630c-0410-9148-cb99ea01b6c8
- perform extra LaTeX run when requested by lettre.cls (bug 5818).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28828 a592a061-630c-0410-9148-cb99ea01b6c8
- perform an additional bibtex cycle if requested
(e.g. by Biblatex)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27724 a592a061-630c-0410-9148-cb99ea01b6c8