Commit Graph

33260 Commits

Author SHA1 Message Date
Scott Kostyshak
cd8be655f1 Export/view a PDF even if error
A PDF is often still produced after a LaTeX error.

If there was an error when exporting a PDF, we now give an error
and the PDF (if it exists), where before we gave the error and
not the PDF. The GUI and command line behaviors are consistent:
in the GUI an error is given and the PDF is viewed; on the
command line, a non-zero exit code is given and a PDF is created.

This also solves what was in my mind an inconsistency: if the user
"updated" a document and there was an error, the resulting
PDF would be shown; but if the user viewed a document and there
was an error, the document would not be shown.

Note that this applies to all output formats, not just PDF.

For discussion, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg186454.html
2015-03-20 02:21:31 -04:00
Scott Kostyshak
0a6120cb7f Improve log scanner to correctly report error
When scanning the LaTeX log, previously we only looked ahead 10 lines
after a "!" line and if we did not find a line number we did not count
an error. This lead to the problem that templates/ACM-sigplan.lyx was
showing a successful export and the PDF was shown (it is still
created despite the error). Now that the exit code of the latex
command is checked (as of the previous commit), an error is correctly
given, but by parsing the log better with this commit, a more
informative error is given.

Increasing the look-ahead to 15 lines leads to correct parsing of
the ACM-sigplan log. The excerpt in the log file where there are more
than 10 lines in-between the "!" line and the line number is below:

! Undefined control sequence.
\@toappear ...ent http://dx.doi.org/10.1145/\@doi

<argument> ...n is removed.]\par \else \@toappear
                                                  \fi \if \@reprint
\noinden...

\@begin@tempboxa ...mpboxa #1{\color@begingroup #2
                                                  \color@endgroup }\def
\wid...

\@iiiparbox ...tempdima \@parboxrestore #5\@@par }
                                                  \ifx \relax #2\else
\setle...

\@copyrightspace ...planconf@finalpage}.\par \fi }
                                                  }\end@float
\maketitle ... \@copyrightwanted \@copyrightspace
                                                  \fi
l.34 \maketitle

Another example is posted here:
http://tex.stackexchange.com/questions/231655/lyx-cannot-output-to-pdflatex-for-a-specific-file
2015-03-20 02:19:44 -04:00
Scott Kostyshak
1dbf0e5aab Check exit code of LaTeX process in LaTeX::run
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
2015-03-20 02:19:44 -04:00
Scott Kostyshak
f74b2b79c7 Allow cloned buffers to give alerts in runLaTeX()
This was disabled in 2009 in bea0925f but it is now safe.

From Richard:
"I am pretty sure that all the work that Peter Kümmel did with the
InGuiThread classes dealt with this issue."
2015-03-20 02:19:44 -04:00
Scott Kostyshak
4f0593f91b Remove an outdated comment
LaTeX::deleteFilesOnError is no longer a dummy function.

This comment was interoduced with the first version of this
function, at e6d063c4.
2015-03-20 02:19:44 -04:00
Scott Kostyshak
2bfbf75eed Remove output file in temporary folder on error
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.
2015-03-20 02:19:26 -04:00
Scott Kostyshak
6343d9941a Clarify message about an empty file
When empty output is generated, no PDF is produced. The previous
message made it seem like an empty PDF was produced.
2015-03-20 01:34:11 -04:00
Juergen Spitzmueller
49df5ef93d SVG: text -> Path 2015-03-19 09:25:05 +01:00
Georg Baum
3b6232679d Improve source code documentation
Adjust comments to current code and extend them a bit, also revert a part
of af5acb6d which was certainly not wanted.
2015-03-18 21:33:10 +01:00
Georg Baum
423a55acc6 whitespace 2015-03-18 21:33:10 +01:00
Georg Baum
3d492529bf Fix math macro plain text output
Previously it was not thread safe, and the translation could be wrong.
2015-03-18 21:33:09 +01:00
Enrico Forestieri
3cd15806bd Revise svg icons for the math toolbar
- Use paths, not fonts. Have a look at the sqrt icon in the image attached
  here http://thread.gmane.org/gmane.editors.lyx.devel/154179/focus=154183
  to see what may happen when a font is not present on a given system.
- Make uniform the height of the parentheses.
- Move a couple of icons to the oxygen subdir (I was not sure it was Ok
  replacing them. If yes, they can be simply deleted).
2015-03-18 20:29:31 +01:00
Jean-Marc Lasgouttes
6010f38e01 Use integer arithmetic for drawing logos; fix LaTeX output
Using fraction of points is a reasonable way to avoid warnings with fussy compilers.

Moreover, this fixes the output of PHRASE_LATEX2E to use the proper form \LaTeXe.

The file format still uses the questionnable form \\LaTeX2e.
2015-03-18 11:32:49 +01:00
Kornel Benko
6787ec05f7 Cmake build: Add .svgz files to Resources.
It does not seam to make a difference.
Added because other icons are also included.
2015-03-17 20:46:02 +01:00
Kornel Benko
e0c3379645 New test for seach and replace of a logo 2015-03-17 17:52:37 +01:00
Kornel Benko
034d5632a2 Make tests for QT5 and QT4 work.
Changing *-in.txt due to erroneous shortcuts in it.po
keytest.py, single-test.cmake and CMakeLists.txt now
provide a frontend hint for xvkbd.
2015-03-17 17:36:47 +01:00
Jean-Marc Lasgouttes
ba0b847040 Toggle properly toolbar icons that set layout of a paragraph.
Fixes bug #9463.
2015-03-17 16:40:55 +01:00
Jean-Marc Lasgouttes
8aa2d6b184 Fix setting Interlingua as GUI language
The problem came from the fact that Qt associates Interlingua to locale C.
Now, we do not rely anymore on the Qt locale to set the language. I suspect that the problem will still exist if the system locale is ia_IA.

Fixes bug #9267.
2015-03-17 12:37:24 +01:00
Juergen Spitzmueller
7aad787047 fixltx2e must be loaded as early as possible
Fixes: #9452, #9361

This reverts the 'fix' to #7233, which must be solved differently.
2015-03-17 10:24:33 +01:00
Jean-Marc Lasgouttes
5b80d57d1d add "Keywords" to lyx.desktop file
Fixes bug #9414.
2015-03-17 10:17:35 +01:00
Enrico Forestieri
7be7fb76f9 Update it.po 2015-03-17 00:33:37 +01:00
Juergen Spitzmueller
af4090bb0a Make the missing class warning opt-out 2015-03-16 20:34:32 +01:00
Juergen Spitzmueller
f305f0b4d8 Properly handle the bicaption package (bug #9449) 2015-03-16 20:31:38 +01:00
Jean-Marc Lasgouttes
477fddebe5 Add proper importers for Sweave and knitr.
Fixes bug #8734.
2015-03-16 18:43:51 +01:00
Jean-Marc Lasgouttes
ed3d9544a3 Improve undo of consecutive insertions/deletions
The old scheme was:
 * multiple insertions are undone by groups of 20
 * multiple deletions are undone in one big block

The new scheme is to stop merging undo elements after 2 seconds of elapsed time.

Moreover, the merging of undo elements stops when the cursor has moved. Potentially, this could allow to remove many of the finishUndo() calls.

Fixes bug #9204.
2015-03-16 18:31:22 +01:00
Juergen Spitzmueller
d2ab8e1b65 Add missing breaks (and time for a break :-() 2015-03-16 14:49:58 +01:00
Juergen Spitzmueller
fd5d47d182 More switches and whitespace fixes 2015-03-16 14:47:38 +01:00
Juergen Spitzmueller
439e4284ba de.po 2015-03-16 14:31:24 +01:00
Juergen Spitzmueller
066d6a9cfb Grr... 2015-03-16 14:30:02 +01:00
Juergen Spitzmueller
bc85f0fdf7 Properly escape backslash in string 2015-03-16 14:28:16 +01:00
Juergen Spitzmueller
245c2b3c45 InsetPhantom::latex(): use a switch 2015-03-16 14:22:03 +01:00
Juergen Spitzmueller
e30db1e444 Whitespace
Time to properly set up QtCreator...
2015-03-16 14:15:05 +01:00
Juergen Spitzmueller
d044d6afa7 Phantom is fragile (#9456) 2015-03-16 14:11:45 +01:00
Kornel Benko
3e148e0da6 update sk.po 2015-03-16 12:30:08 +01:00
Juergen Spitzmueller
596fc8510e Use German localization in German europass example 2015-03-16 11:23:24 +01:00
Juergen Spitzmueller
1957af41e1 de.po 2015-03-16 11:12:55 +01:00
Enrico Forestieri
1af2242c7e Refine fix for #9453
It is better to introduce a dummy blank dir in TEXINPUTS rather than
appending a blank at the end. Even if I have checked that this is not
a problem with MikTeX, some other engine (maybe texlive, but I cannot
check) could not ignore this space and take it as the name of a dir.
In this case, TEXINPUTS would not end with an empty element and the
standard search path would not be inserted there.
2015-03-16 10:55:54 +01:00
Juergen Spitzmueller
06776f2c8f Add Stefan Swerk to the Credits 2015-03-16 10:54:02 +01:00
Juergen Spitzmueller
d02147b79e Add support for the europasscv class
Patch by Stefan Swerk
2015-03-16 10:47:17 +01:00
Enrico Forestieri
0a5e1f20fc Fix bug #9453
This was due to a problem with the QProcess parser.
See #9453 for details.
2015-03-16 00:34:35 +01:00
Kornel Benko
fcf8d1a746 make build: Make it compilable for Qt4 too. 2015-03-15 20:12:55 +01:00
Jean-Marc
1f36fa6d56 Document the drawing of logos
Also fix a couple of spacings.
2015-03-15 18:21:01 +01:00
Georg Baum
73c3f3e2fd Improve code readability
Using a small helper struct instead of a std::pair makes things like
it->second.first a little less confusing: it->second.scope.
2015-03-15 13:57:45 +01:00
Georg Baum
5bb7857bb2 Add missing check
The other insert method has this as well, and it is indeed a problem is pos
points outside the vector.
2015-03-15 13:56:48 +01:00
Juergen Spitzmueller
187c5f0ef5 Use QLocale::toDouble instead of QString::toDouble in the length validator
Fixes: #9214
2015-03-15 11:48:36 +01:00
Juergen Spitzmueller
d9626ec6af Set the logic straight 2015-03-15 10:38:37 +01:00
Juergen Spitzmueller
d15388ba98 Allow to disable inputenc loading via 'Provides inputenc 1' 2015-03-15 10:29:07 +01:00
Juergen Spitzmueller
048b5fcb67 Better oxygen citation icon 2015-03-15 09:12:17 +01:00
Juergen Spitzmueller
c0ce194299 Oxygen svg: transform more text to paths 2015-03-15 09:02:56 +01:00
Enrico Forestieri
8fbe17c4d9 Install the svg icons. 2015-03-15 02:52:29 +01:00