我想用TikZ包创建一个简单的乳胶流程图,类似于下面的例子
http://www.texample.net/tikz/examples/simple-flow-chart/
但是我想在流程图中包含数字(在R中创建的时间序列图,如eps或其他)(例如在{block}中?
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em]
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (init) {initialize model};
\node [cloud, left of=init] (expert) {expert};
\node [cloud, right of=init] (system) {system};
\node [block, below …Run Code Online (Sandbox Code Playgroud) 我正在使用Gnuplot 4.4,使用Lua支持编译.据说它有tikz终端.
我使用"set terminal tikz"成功地将我的gnuplots编译为tex.但是,将此源添加到我的latex文档时,我不断收到以下错误:
!包pgfkeys错误:我不知道键'/ tikz/gnuplot',我将忽略它.也许你拼错了它.
我在原始tex文档中包含了tikz包.有任何想法吗?
编辑:解决了.见下面的答案.
我的序言目前看起来像这样:
\documentclass[12pt,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage{subfigure}
\usepackage[pdftex]{graphicx}
\usepackage{latexsym}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{listings}
\usepackage{geometry}
Run Code Online (Sandbox Code Playgroud)
当我包括
\usepackage{tikz}
Run Code Online (Sandbox Code Playgroud)
我收到错误消息!LaTeX 错误:未找到文件“xcolor.sty”。
我尝试在 tikz 之前和之后添加 \include{xcolor} ,但没有成功。另外,从另一篇文章中我发现我应该在声明文档类之前 \PassOptionsToPackage{table}{xcolor} 。无论我做什么,我仍然会遇到同样的错误。我究竟做错了什么?
我试图用箭头绘制图形,我希望箭头的标签位于线条之间(不在上方或下方),如下所示:输出应如何显示:

我正在使用tikz库和边缘节点在两个节点之间绘制箭头.这是箭头上方标签的最小示例:
\documentclass[12pt]{article}
\usepackage[letterpaper, margin=1in, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage{xcolor}
\definecolor{corn}{rgb}{0.98, 0.93, 0.36}
\definecolor{emerald}{rgb}{0.31, 0.78, 0.47}
\usepackage{array}
\usepackage{tikz}
\usepackage{siunitx}
\usepackage{float}
\usepackage{subcaption,caption}
\captionsetup{labelsep=period}
\usetikzlibrary{positioning,patterns,arrows,decorations.markings,decorations.pathreplacing,shapes,shapes.misc}
\tikzset{
%Define standard arrow tip
>=stealth',
% Define arrow style
pil/.style={
->,
thick,
shorten <=3pt,
shorten >=3pt,}
}
\title{ }
\begin{document}
\maketitle
\begin{figure}[h!]
\centering
\caption{}
\label{paths}
\begin{subfigure}{0.9\textwidth}
\resizebox{.9\textwidth}{!}{
\begin{tikzpicture}[shorten >=2pt,on grid,auto]
\node (A) [draw=black,fill=emerald,double=white,double distance=2pt,shape=rounded rectangle,minimum width=4cm ]{A};
\node[right=9cm of A] (B) [draw,fill=corn,shape=rounded rectangle,minimum width=4cm ]{B};
\path[->]
(A) edge[line width=0.742mm] node[ anchor=center, above, pos=0.5,font=\bfseries] {\Huge +} (B);
\end{tikzpicture}
} …Run Code Online (Sandbox Code Playgroud) 我猜想这是以前在线程中完成的,但是我只花了两个小时阅读各种线程,却无法解决一个非常基本的问题。
长话短说:我正在尝试在网络浏览器中为作业生成器创建动态方程式/图表。到目前为止,我一直在使用MathJax并将其用于事物的方程式方面。这很简单,因为我只需要包含一行Javascript代码,然后开始编写代码就很好了:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['|','|'], ['\\
(','\\)']]}});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX- AMS-MML_HTMLorMML">
</script>
<?
$x = rand(2,5);
echo "x|^2| = ".pow($x,2).", so x = |\pm|$x";
?>
Run Code Online (Sandbox Code Playgroud)
并将其正确地转换为浏览器上的方程式。
现在,我的目标是做类似的事情,TikZ因此我可以使用以下代码动态创建三角形等:
<?
$vertex1 = rand(2,5);
$vertex2 = rand(2,5);
?>
\documentclass[12pt, border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node[anchor=north]{$A$}
-- (<? echo $vertex1; ?>,0) node[anchor=north]{$C$}
-- (<? echo $vertex1; ?>,<? echo $vertex2; ?>) node[anchor=south]{$B$}
-- cycle;
\end{tikzpicture}
\end{document}
Run Code Online (Sandbox Code Playgroud)
所以我的第一个问题,我认为回答“否”,但无论如何都值得检查-是否有一种简单的方法可以TikZ像MathJax一样调用Javascript?因为那太神奇了。
如果没有,我怎么能到达可以实际使用的TikZ地方HTML/Javascript?我相信有些网站会显示TikZ代码,但是我找不到关于此的任何文档(所有内容都假设我使用的LaTeX程序可以TikZ通过简单的\usepackage{tikz} …
我使用 TikZ 得到了以下图表:
\begin{tikzpicture}
\tikzset{vertex/.style = {shape=circle,draw,minimum size=2em}}
\tikzset{edge/.style = {->,> = latex'}}
% Vertices
\node[vertex] (s) at (0,0) {s};
\node[vertex] (t) at (2,-2) {t};
\node[vertex] (v) at (-2,-2) {v};
\node[vertex] (w) at (2,-5) {w};
\node[vertex] (u) at (-2,-5) {u};
% Edges
\draw[edge, ultra thick] (s) to (t);
\draw[edge, ultra thick] (s) to (v);
\draw[edge, ultra thick] (t) to (w);
\draw[edge, ultra thick] (v) to (u);
\draw[edge] (t) to (u);
\draw[edge] (v) to (w);
\end{tikzpicture}
Run Code Online (Sandbox Code Playgroud)
使用此语法向该图添加边权重的最佳方法是什么?
我正在尝试绘制一些曲线,但效果不太好。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ticks=none,
xtick distance=1,
ytick distance=1,
axis equal image=true,
grid,
grid style={gray!50},
grid=both,
xlabel={$x$},
ylabel={$y$},
axis lines=middle,
xmin=-4, xmax=9, ymin=-5, ymax=4,
axis x line=center,
axis y line=center,
]
\addplot[thick, smooth] plot coordinates
{
(-3, -1)
(-.5, -3)
(.5, -1.9)
(1.5, -2.8)
(3.5, 1)
(5.5, 3)
(7.5, -1.95)
(8, -1.5)
};
\end{axis}
\end{tikzpicture}
\end{document}
Run Code Online (Sandbox Code Playgroud)
是否可以在不添加大量点的情况下构建如此平滑的曲线?在原图中,您可以看到几个参考点。有什么办法可以配置\addplot或者其他命令吗?
长期 LaTeX 用户但第一次发帖。我对 TikZ 的了解不够,不知道是否有更好的方法来解决这个问题。
我试图在每个页面的顶部添加装饰性页面边框,使其类似于航空信封的边框:蓝色、空白和红色平行四边形的重复序列。这是一种全出血图案,打印时将延伸到物理页面的边缘。下面的例子。

如果可能的话,我想在 LaTeX 中生成这个模式,并且已经用 TikZ 尝试了一些东西,但成功有限。我可以在页面边缘绘制一个粗边框(下面的 MWE),但无法修改此代码来绘制连续的平行四边形,因为我已经超出了 TikZ 的深度。
\documentclass[12pt]{scrartcl}
\usepackage{lipsum}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
%\usetikzlibrary{patterns}
\usepackage{scrlayer-scrpage}
\begin{document}
\newcommand{\myborder}{\tikz[remember picture,overlay]
\draw [blue,line width=5mm]
(current page.north west)
rectangle
(current page.north east)
;}
\chead[\myborder]{\myborder} % for page borders
\lipsum[1-3]
\end{document}
Run Code Online (Sandbox Code Playgroud)
绘制平行四边形的一种方法使用节点https://tex.stackexchange.com/a/106995/212004但我的应用程序不需要平行四边形中的文本,并且我无法修改此代码以满足我的需要。
这种方法更简单https://tex.stackexchange.com/a/136958/212004但我无法充分修改此代码以使其与 MWE 中的边界代码一起使用。
我被困住了,非常感谢一些关于如何解决这个问题的指导。
谢谢!
我正在 pgf 中编写一些形状,我并不真正了解其工作原理,但我设法阅读了文档。
\pgfdeclareshape{reg}{
% The 'minimum width' and 'minimum height' keys, not the content, determine
% the size
\savedanchor\northeast{%
\pgfmathsetlength\pgf@x{\pgfshapeminwidth}%
\pgfmathsetlength\pgf@y{\pgfshapeminheight}%
\pgf@x=0.11\pgf@x
\pgf@y=0.15\pgf@y
}
% This is redundant, but makes some things easier:
\savedanchor\southwest{%
\pgfmathsetlength\pgf@x{\pgfshapeminwidth}%
\pgfmathsetlength\pgf@y{\pgfshapeminheight}%
\pgf@x=-0.11\pgf@x
\pgf@y=-0.15\pgf@y
}
% Inherit from rectangle
\inheritanchorborder[from=rectangle]
% Define same anchor a normal rectangle has
\anchor{center}{\pgfpointorigin}
\anchor{north}{\northeast \pgf@x=0pt}
\anchor{east}{\northeast \pgf@y=0pt}
\anchor{south}{\southwest \pgf@x=0pt}
\anchor{west}{\southwest \pgf@y=0pt}
\anchor{north east}{\northeast}
\anchor{north west}{\northeast \pgf@x=-\pgf@x}
\anchor{south west}{\southwest}
\anchor{south east}{\southwest \pgf@x=-\pgf@x}
\anchor{text}{
\pgfpointorigin
\advance\pgf@x by -.5\wd\pgfnodeparttextbox%
\advance\pgf@y by -.5\ht\pgfnodeparttextbox% …Run Code Online (Sandbox Code Playgroud) 我希望它的元素在我的投影仪演示文稿中按特定顺序出现。目前,我正在尝试使 a_1、a_2 出现在第二张幻灯片中。我正在使用这段代码:
\documentclass{beamer}
\usepackage{textcomp}
\usepackage{tikz}
\usetheme{Madrid}
\begin{document}
\begin{frame}{}
\usetikzlibrary{shapes,arrows, positioning, calc}
\tikzset{%
block/.style = {rounded corners, draw, thick, circle, minimum height = 3em,
minimum width = 3em, fill = yellow!50},
point/.style = {coordinate}, % Input
}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
%\node[block] (A1) at (0,0) {$A_1$};
%\node[block, right = 1cm of A1] (A2) {$A_2$};
\node[below = of A1] (a1) {{\visible<2->{$a_1$}}};
\node[below = of A2] (a2) {{\visible<2->{$a_2$}}};
\node[below = of A1] (a1) {$a_1$};
\node[below = of A2] (a2) …Run Code Online (Sandbox Code Playgroud)