我是 LaTeX 的初学者,目前正在学习 TikZ。为了练习,我决定重新创建说明书中为 Estes 模型火箭提供的管标记指南(如下图所示)。
我已经相当准确地复制了几乎所有内容(可能不是很有效,但无论如何复制了)。这是我当前的代码及其输出(请注意,外部引用的 Estes 徽标可以在谷歌图片):
\documentclass{article}
\usepackage{helvet}
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage{tikz}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\draw[black, very thick] (0,0) rectangle (5.0625in,1.875in);
\draw[black, very thick, <->] (0.625in,0) -- (0.625in,1.875in);
\draw[black, very thick, <->] (1.875in,0) -- (1.875in,1.875in);
\draw[black, very thick, <->] (3.1875in,0) -- (3.1875in,1.875in);
\draw[black, very thick, <->] (4.45in,0) -- (4.45in,1.875in);
\draw[black, very thick] (0,0.5in) -- (0.25in,0.5in);
\draw[black, very thick] (0,1.375in) -- (0.25in,1.375in);
\draw[black, very thick] (4.8125in,0.5in) -- (5.0625in,0.5in);
\draw[black, very thick] (4.8125in,1.375in) -- (5.0625in,1.375in);
\filldraw[color=black, fill=gray!30, thick] (5.0625in,0) rectangle (5.375in,1.875in);
\filldraw[color=black, fill=white, very thick] (1in,0.25in) -- (1in,1.625in) -- (4.5in,1.4375in) -- (4.5in,0.4375in) -- cycle;
\draw[black, very thick, loosely dashed] (2.5in,0.33in) -- (2.5in,1.545in);
\draw[black, very thick, loosely dashed] (3.6875in,0.394in) -- (3.6875in,1.481in);
\node[rotate=90] (Estes) at (1.23in,0.9375in) {\includegraphics[width=0.17\textwidth]{Images/estes-logo.png}};
\node[rotate=90] at (0.1in,0.9375in) {\footnotesize \textbf{LL}};
\node[rotate=90] at (0.725in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (1.975in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (3.2875in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (4.55in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (2.1in,0.9375in) {\huge \textbf{3}};
\node[rotate=90] at (3in,0.9375in) {\huge \textbf{2}};
\node[rotate=90] at (4in,0.9375in) {\huge \textbf{1}};
\end{tikzpicture}
\caption{Big Bertha tube marking guide.}
\label{fig:bigbertha}
\end{figure}
\end{document}
据我估计,此时我唯一缺少的就是图片右侧灰色框中的堆叠斜线。如何创建这些线条?
我曾尝试过grid
,yslant
但是它并没有准确地切断顶部和底部,并且留下了垂直线。
欢迎所有建议,谢谢!
答案1
我在这里重点介绍线条。它们可以用 来实现path picture
。对于较大的图片,您可能需要增加 35
。
\documentclass{article}
\usepackage{helvet}
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage{tikz}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\draw[black, very thick] (0,0) rectangle (5.0625in,1.875in);
\draw[black, very thick, <->] (0.625in,0) -- (0.625in,1.875in);
\draw[black, very thick, <->] (1.875in,0) -- (1.875in,1.875in);
\draw[black, very thick, <->] (3.1875in,0) -- (3.1875in,1.875in);
\draw[black, very thick, <->] (4.45in,0) -- (4.45in,1.875in);
\draw[black, very thick] (0,0.5in) -- (0.25in,0.5in);
\draw[black, very thick] (0,1.375in) -- (0.25in,1.375in);
\draw[black, very thick] (4.8125in,0.5in) -- (5.0625in,0.5in);
\draw[black, very thick] (4.8125in,1.375in) -- (5.0625in,1.375in);
\filldraw[color=black, fill=gray!30, thick,path picture={
\draw foreach \X in {-2,-1,...,35}
{([yshift=\X*4pt]path picture bounding box.south east)
-- ([yshift=\X*4pt+3pt]path picture bounding box.south west)};
}]
(5.0625in,0) rectangle (5.375in,1.875in);
\filldraw[color=black, fill=white, very thick] (1in,0.25in) -- (1in,1.625in) -- (4.5in,1.4375in) -- (4.5in,0.4375in) -- cycle;
\draw[black, very thick, loosely dashed] (2.5in,0.33in) -- (2.5in,1.545in);
\draw[black, very thick, loosely dashed] (3.6875in,0.394in) -- (3.6875in,1.481in);
%\node[rotate=90] (Estes) at (1.23in,0.9375in) {\includegraphics[width=0.17\textwidth]{Images/estes-logo.png}};
\node[rotate=90] at (0.1in,0.9375in) {\footnotesize \textbf{LL}};
\node[rotate=90] at (0.725in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (1.975in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (3.2875in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (4.55in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (2.1in,0.9375in) {\huge \textbf{3}};
\node[rotate=90] at (3in,0.9375in) {\huge \textbf{2}};
\node[rotate=90] at (4in,0.9375in) {\huge \textbf{1}};
\end{tikzpicture}
\caption{Big Bertha tube marking guide.}
\label{fig:bigbertha}
\end{figure}
\end{document}
答案2
patterns
tikzlibrary
您可以使用和选项获得以下结果pattern=north west lines
:
\documentclass{article}
\usepackage{helvet}
\usepackage[letterpaper, margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{patterns}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\draw[black, very thick] (0,0) rectangle (5.0625in,1.875in);
\draw[black, very thick, <->] (0.625in,0) -- (0.625in,1.875in);
\draw[black, very thick, <->] (1.875in,0) -- (1.875in,1.875in);
\draw[black, very thick, <->] (3.1875in,0) -- (3.1875in,1.875in);
\draw[black, very thick, <->] (4.45in,0) -- (4.45in,1.875in);
\draw[black, very thick] (0,0.5in) -- (0.25in,0.5in);
\draw[black, very thick] (0,1.375in) -- (0.25in,1.375in);
\draw[black, very thick] (4.8125in,0.5in) -- (5.0625in,0.5in);
\draw[black, very thick] (4.8125in,1.375in) -- (5.0625in,1.375in);
\filldraw[color=black, thick, pattern=north west lines] (5.0625in,0) rectangle (5.375in,1.875in);
\filldraw[color=black, fill=white, very thick] (1in,0.25in) -- (1in,1.625in) -- (4.5in,1.4375in) -- (4.5in,0.4375in) -- cycle;
\draw[black, very thick, loosely dashed] (2.5in,0.33in) -- (2.5in,1.545in);
\draw[black, very thick, loosely dashed] (3.6875in,0.394in) -- (3.6875in,1.481in);
\node[rotate=90] (Estes) at (1.23in,0.9375in) {\includegraphics[width=0.17\textwidth]{Images/estes-logo.png}};
\node[rotate=90] at (0.1in,0.9375in) {\footnotesize \textbf{LL}};
\node[rotate=90] at (0.725in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (1.975in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (3.2875in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (4.55in,0.2in) {\footnotesize \textbf{FL}};
\node[rotate=90] at (2.1in,0.9375in) {\huge \textbf{3}};
\node[rotate=90] at (3in,0.9375in) {\huge \textbf{2}};
\node[rotate=90] at (4in,0.9375in) {\huge \textbf{1}};
\end{tikzpicture}
\caption{Big Bertha tube marking guide.}
\label{fig:bigbertha}
\end{figure}
\end{document}
如果要保留灰色背景并在其上绘制图案,请使用\filldraw[color=black, preaction={fill, gray!30},, thick, pattern=north west lines]