A friend gave me a copy of his thesis template (which works for him), but when I try to use it myself, most of the LaTeX 'view' options are grayed out:

grayed out latex options

Strangely enough, the options aren't grayed out for any of my other documents, and I can compile all of my other files (including, for example, the LyX documentation files).

I have tried Reconfiguring and restarting, but it makes no difference, which is not surprising given that if I have my own files open in different tabs of the same instance of LyX, they can still be viewed.

He does use a custom layout and style in his document, which is included in the same directory. However if I switch the document class to the standard Book class, the view options remain grayed out - although there is a warning then that some of his custom environments are not found in the new layout, so that might be causing problems as well.

He includes a number of chapter lyx files inside the main document, they're all accessible, but they suffer from the same problem.


@Torbjørn-T Your comment was correct, and after making the chance I can now attempt to render to pdflatex.

Following on from @scottkosty's comment, when I try to render any of the files that are using my friend's (apparently faulty?) style/layout files, I get the message "Error while exporting format: PDF (pdflatex)" in the status bar, but no dialog boxes. In the message pane, it says the following:

21:51:17.771: Exporting ...
21:51:17.820: (buffer-update: Ctrl+Shift+R)
21:51:17.828: pdflatex  "minimal.tex"
21:51:17.854: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
21:51:17.855:  restricted \write18 enabled.
21:51:17.863: entering extended mode
21:51:17.864: (./minimal.tex
21:51:17.865: LaTeX2e <2011/06/27>
21:51:17.866: Babel <3.9h> and hyphenation patterns for 2 languages loaded.
21:51:18.042: Error while exporting format: PDF (pdflatex)support/Systemcall.cpp (292): Systemcall: 'pdflatex  "minimal.tex"' finished with exit code 1

When I execute "pdflatex minimal.tex" from the lyx buffer directory in /tmp, I get the same output (up to the Babel line) and exit code.

I've managed to cut the offending file down to the barest minimum (just "foo" in Standard mode, but using the custom layout) and it's still happening, so it's almost certainly some problem with his custom layout/style, which I'm still teasing out. Still, LyX should probably give a dialog saying that pdflatex failed with no output, rather than only flashing an error in the status bar.

...edit 2...

Okay, I figured out what it was: the custom .sty was using \usepackage{fontspec}, and if you remove the \batchmode in the resulting .tex file, it gives this error when you run pdflatex:

! Fatal fontspec error: "cannot-use-pdftex"
! The fontspec package requires either XeTeX or LuaTeX to function.
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
! See the fontspec documentation for further information.
! For immediate help type H <return>.

which is all fair enough. Here is a minimal lyx document that reproduces this - it's a brand new, empty lyx file with \usepackage{fontspec} in the preamble.

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\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
\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


\begin_layout Standard


  • Welcome to TeX-sx! The available options suggest that the LyX file here requires LuaTeX, probably using system fonts. Is that the case? – Joseph Wright Mar 6 '15 at 11:50
  • 1
    To follow up on Joseph's comment: Go to Document --> Settings --> Fonts and check if Use non-TeX fonts is checked or not. If it is you can't use pdflatex. – Torbjørn T. Mar 6 '15 at 12:01
  • That was it, thank you. I can now attempt to render with pdflatex. The attempt fails with no error and an exit code 1, but it's a start. I'll have to investigate further... – Widjet Mar 6 '15 at 22:13
  • @Widjet can you post an example? I'm really interested in the "fails with no error" part. I'm working on changing this for the next release in LyX. – scottkosty Mar 7 '15 at 7:04
  • @scottkosty I've added more details to the question, though I don't think an example is really worthwhile in this case. – Widjet Mar 8 '15 at 11:50

In short, the template I was given was designed to be used with xelatex, and made use of the fontspec package, which is not supported by pdflatex.

joseph-wright and torbjørn-t's comments were the solution to the first problem I had:

To follow up on Joseph's comment: Go to Document --> Settings --> Fonts and check if Use non-TeX fonts is checked or not. If it is you can't use pdflatex.

Afterwards, it still wouldn't compile until I remove the \usepackage{fontspec} from within the template's style file. The reason for the error wasn't reported by default, but can be elucidated by removing \batchmode from the generated tex file.

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.