1

When I hit Ctrl + R, I get this error:

The external program ... finished with an error. It is recommended you fix the cause of the external program's error (check the logs).

What is this external program and how do I check its logs?


(I have since discovered that my specific error here was due to my failure to insert appropriate backslashes in ERT URLs. But my question still stands.)

MWE from LyX below.

enter image description here

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
hfill
\backslash
raisebox{-0.5pt}{
\backslash
href{
\end_layout

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

https://www.wolframalpha.com/input/?i=1%2B1
\end_layout

\end_inset


\begin_inset ERT
status open

\begin_layout Plain Layout

}{
\backslash
includegraphics[scale=0.04]{1.pdf}}}
\end_layout

\end_inset


\end_layout

\end_body
\end_document
  • Can you post an example .lyx file? I can't reproduce that error. I tried to reproduce but LyX tells me the LaTeX error "Undefined control sequence..." – scottkosty Nov 9 '18 at 5:58
  • @scottkosty: Indeed, when I try to copy paste the offending line in a new LyX file, I get "Emergency stop" instead --- \hfill\raisebox{-0.5pt}{\href{https://www.wolframalpha.com/input/?i=1%2B1}{\includegraphics[scale=0.04]{1.pdf}}} where 1.pdf is any PDF file you have available. – Kenny LJ Nov 9 '18 at 8:06
  • Can you post an example .lyx file? Please see here for more information: wiki.lyx.org/FAQ/MinimalExample – scottkosty Nov 9 '18 at 17:54
  • @scottkosty: Please see edited post. – Kenny LJ Nov 10 '18 at 2:04
  • 1
    What does Document > LaTeX Log reveal? – Werner Nov 10 '18 at 2:48
1

Your ERT boxes should have a code like this:

\hfill\raisebox{-0.5pt}{%
\href{https://www.wolframalpha.com/input/?i=1\%2B1}{%
\includegraphics[scale=0.04]{example-image}}} 

Note the backslash before %2B1, since otherwise the end of URL become a LaTeX comment, breaking the \href argument ! Beside, there are no reason to split the code in 3 ERT boxes: one is enough and this way there are less risk to include a wrong space between ERT boxes.

On the other hand, not less important, as all the content of the document is only ERT boxes that are invisible for LyX, the program will not take care of the packages defining these commands, so at least you must load the required packages manually in Documents > Settings .. Latex preamble:

\usepackage{graphicx}
\usepackage{hyperref}

Then will work:

mwe

Although that results as is is not very nice, I suggest add at least the colorlinks option to hyperref.

Alternatively, you can also insert at least one image and one hyperlink out of the ERT box, using the Lyx tools so the packages are load automatically. In that case, even if you already wrote the above, LyX will remove that lines to avoid conflicts with the automatic loads.

With respect to how deal with error messages, you can:

  1. In the error window push the bottom-left button View Complete log and you will see:

This is` pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2018.7.29) ....

  1. Alternatively, run lyx from a terminal, that show another type of error as Systemcall.cpp (294): Systemcall: 'pdflatex "newfile1.tex"' finished with exit code 1.

The first method will give error about the compilation whereas the second could be any error about Lyx and their external programs, loading files, etc.

But in that examples, with both methods you see that the problematic external program is pdftex (pdflatex is really only a link to pdftex with preloaded "pdflatex" format), but obviously the second method say nothing about the cause of the error. When the description is not enough, the complete log (overall near of the end) could give you some more clues of what is happening. But admittedly, the error messages at first are a bit cryptic anyway. Concretely "File ended while scanning use of \foo" could mean that you type \foo{ instead of \foo{}. It would have been much clearer to say "Wise up! The argument of \foo never end!" but with time you will appreciate the mysterious charm of these messages :)

  • there are no reason to split the code in 3 ERT boxes --- the reason I do this is so that in LyX, I can quickly replace the URL by selecting the middle box, then hitting Ctrl + A and Ctrl + V. – Kenny LJ Nov 11 '18 at 2:55
  • Also, my question wasn't really about this particular error at all. It was about which external program and which logs to look at. I merely copy-pasted the offending line onto a new LyX file to produce a MWE because @scottkosty requested it. – Kenny LJ Nov 11 '18 at 3:04
  • @KennyLJ I Updated the answer explaining the error messages. – Fran Nov 11 '18 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.