0

I'm not sure if I'm doing something wrong or if I've found a bug in LyX, but its preview feature is just completely breaking when I try to use the patterns TikZ library.

It does produce the correct output when I tell it to actually render to pdf, so that isn't the problem.

It doesn't give any error; instead, it simply displays a 'preview' that is completely blank and fills the entire width of the screen. This is the code:

\begin{tikzpicture}
    \draw [fill] (-0.025in,-0.025in) rectangle (0.2125in,2.525in);
    \draw [brown, fill=brown] (0,0) rectangle (0.1875in,2.5in);

    \draw [fill] (-0.025in,2.725in) rectangle (0.2125in,5.275in);
    \draw [brown, fill=brown] (0,2.75in) rectangle (0.1875in,5.25in);

    \pattern [pattern=north west lines] (4.1875in,5.25in) -- (4.1875in,0) -- (4.4375in,0) -- (4.4375in,5.25in) -- cycle;
    \draw [dashed] (4.1875in,-0.25in) -- (4.1875in,0);
    \draw (4.1875in,0) -- (4.1875in,5.25in);
    \draw [dashed] (4.1875in,5.25in) -- (4.1875in,5.5in);
\end{tikzpicture}

and the LaTeX preamble is

\usepackage{tikz}
\usepackage{siunitx}
\usetikzlibrary{patterns}

Apologies for the inconvenient numbers. Imperial units are awkward, but I have to use them for this. (and it's a 1:4 scale, so there's even more awkwardness.)

The only thing I can think of that might have caused this is that I added the patterns library when I realized I needed it, as I was typing this code. But restarting LyX doesn't fix the problem, which suggests that it's not just a loading issue.

Edit: This is on LyX 2.2.3.

What follows is a minimal example:

#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
\begin_preamble
\usepackage{tikz}
\usetikzlibrary{patterns}
\end_preamble
\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
\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
\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 Float figure
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Preview

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{tikzpicture}
\end_layout

\begin_layout Plain Layout


\backslash
draw [fill] (-0.025in,-0.025in) rectangle (0.2125in,2.525in);
\end_layout

\begin_layout Plain Layout


\backslash
draw [brown, fill=brown] (0,0) rectangle (0.1875in,2.5in);
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
draw [fill] (-0.025in,2.725in) rectangle (0.2125in,5.275in);
\end_layout

\begin_layout Plain Layout


\backslash
draw [brown, fill=brown] (0,2.75in) rectangle (0.1875in,5.25in);
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
pattern [pattern=north west lines] (4.1875in,5.25in) -- (4.1875in,0) -- (4.4375in,0)
 -- (4.4375in,5.25in) -- cycle;
\end_layout

\begin_layout Plain Layout


\backslash
draw [dashed] (4.1875in,-0.25in) -- (4.1875in,0);
\end_layout

\begin_layout Plain Layout


\backslash
draw (4.1875in,0) -- (4.1875in,5.25in);
\end_layout

\begin_layout Plain Layout


\backslash
draw [dashed] (4.1875in,5.25in) -- (4.1875in,5.5in);
\end_layout

\begin_layout Plain Layout


\backslash
end{tikzpicture}
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\end_body
\end_document

The preview it gives: enter image description here The (correct) output from rendering a pdf: enter image description here

  • What LyX version are you using? Can you post a minimal example .lyx file? Please see wiki.lyx.org/FAQ/MinimalExample – scottkosty Jul 2 '18 at 23:54
  • @scottkosty this is LyX 2.2.3. I'll see about the minimal example shortly. – Hearth Jul 4 '18 at 1:59

Your Answer

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

Browse other questions tagged or ask your own question.