我不确定我是否做错了什么或者我是否在 LyX 中发现了一个错误,但是当我尝试使用patterns
TikZ 库时,它的预览功能完全崩溃了。
当我告诉它实际渲染为 pdf 时,它确实产生了正确的输出,所以这不是问题。
它不会给出任何错误;相反,它只是显示一个完全空白且填满整个屏幕宽度的“预览”。这是代码:
\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}
LaTeX 序言是
\usepackage{tikz}
\usepackage{siunitx}
\usetikzlibrary{patterns}
抱歉,这些数字不太方便。英制单位不太方便,但我必须用它们。(而且这是 1:4 的比例,所以更不方便。)
我能想到的唯一可能导致此问题的原因是我在输入此代码时意识到需要模式库,然后添加了它。但重新启动 LyX 无法解决问题,这表明这不仅仅是一个加载问题。
编辑:这是在 LyX 2.2.3 上。
下面是一个最简单的例子:
#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