我是 TeX 新手,我正在尝试创建一个包含常规文本、段落等以及介于两者之间的时序图的文档。我正在使用 TikZ 时序包。
这是我正在尝试做的一个例子。
创建一个部分。写一些文字。添加时序图。结束部分并进入下一部分。
这是我尝试过的代码示例。
\documentclass{article}
\usepackage{tikz-timing}[2009/12/09]
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{1mm}
\pagestyle{empty}
\begin{document}
%
% Defining foreground (fg) and background (bg) colors
\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%
%
\begin{section}
1. Timing diagram of SR Flip Flop
Here is the timing diagram of SR flip flop.
\begin{tikztimingtable}[
timing/slope=0, % no slope
timing/coldist=2pt, % column distance
xscale=2.05,yscale=1.1, % scale diagrams
semithick % set line width
]
\scriptsize clock & 7{C} \\
S & [fgblue] .75L h 2.25L H LLl \\
R & [fgblue] 1.8L .8H 2.2L 1.4H 0.8L \\
Q & L .8H 1.7L 1.5H LL \\
$\overline{\mbox{Q}}$ & H .8L 1.7H 1.5L HH \\
Q & [fgred] HLHHHLL \\
$\overline{\mbox{Q}}$ & [fgred] LHLLLHH \\
\extracode
\makeatletter
\begin{pgfonlayer}{background}
% Draw shaded backgrounds
\shade [right color=bgblue,left color=white]
(7,-8.45) rectangle (-2,-4.6);
\shade [right color=bgred,left color=white]
(7,-12.8) rectangle (-2,-8.6);
% Add background grid lines
\begin{scope}[gray,semitransparent,semithick]
\horlines{}
\foreach \x in {1,...,6}
\draw (\x,1) -- (\x,-12.8);
% similar: \vertlines{1,...,6}
\end{scope}
% Add labels
\node [anchor=south east,inner sep=0pt]
at (7,-8.45) {\tiny clocked};
\node [anchor=south east,inner sep=0pt,fgred]
at (7,-12.8) {\tiny positive edge triggered};
\end{pgfonlayer}
\end{tikztimingtable}%
%
\end{section}
\end{document}
我希望 pdf 首先显示文本,然后显示时序图,但只生成了时序图。
有人能帮帮我吗?
谢谢
答案1
注释掉
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength{\PreviewBorder}{1mm}
一切都应该没问题。在这种情况下,该active
选项会预览您在环境中排版的内容tikzpicture
。另外,请考虑更新您的tikz-timing
。据我所知,最新版本是Version v0.7d – 2011/01/09
。以下是注释掉上述几行后的输出。