我使用定位库将带有单词“Start”的圆圈放置在图片的中心:
\node[start] (start) {start};
% row 2
\node[block] (measurement) [below of=start] {Add new measurement, \\ $y_k$ to buffer};
\node[left=6cm of measurement] (level three) {};
我的问题是,是否可以更准确地将起始圆放置在页面的中心,而不是猜测中心在哪里?(例如 0.5\textwidth)
我的第二个问题是,我想纠正一下回归次数到回归解为假并且......。它应该从菱形上方穿过,并像其他 3 支箭头一样从东侧连接菱形。
编辑
数组(向量)问题的解决方案:
\path [line,rounded corners] (i > 0 1.south) |- node[above right,midway] {$i=0$} ($(if 2.east) + (0.5,2)$) -- ($(if 2.east) + (0.5,0)$) -- (if 2.east);
只需在周围创建额外的虚拟点如果 2位置,使用计算图书馆。
解决方案开始我还是没找到这个圈子。
结束编辑 这是我使用的示例代码:
\documentclass[]{scrbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\selectlanguage{english}
\usepackage[]{amsmath,amssymb,amsthm}
\usepackage[landscape,a4paper,left=30mm,right=20mm,top=20mm, bottom=20mm]{geometry}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,matrix,decorations.pathreplacing, shapes. geometric,calc,positioning}
\begin{document}
\tikzset{decision/.style={diamond, aspect=2, draw, fill=blue!20, text badly centered, inner sep=0pt,align=center}}
\tikzset{block/.style={rectangle, draw, fill=blue!20, text centered, rounded corners, align=center}}
\tikzset{line/.style={draw, very thick, color=black!50, -latex'}}
\tikzset{start/.style={shape=circle,draw,minimum size=1.2cm, draw=blue!80, fill=blue!20, text centered, align=center}}
\tikzset{decision answer/.style={near start,color=black,auto}}
\tikzset{datashape/.style={ trapezium, draw, trapezium left angle=60, trapezium right angle=-60}}
\begin{tikzpicture}[node distance=1.5cm, auto, >=stealth, every node/.style={ auto, font=\footnotesize, anchor=center, >=stealth}]
% row 1
\node[start] (start) {start};
% row 2
\node[block] (measurement) [below of=start] {Add new measurement, \\ $y_k$ to
buffer};
\node[left=6cm of measurement] (level three) {};
% row 3
\node[decision] (reg_status) [below left of=level three, node distance=3cm] %
{Regression\\status};%
\node[block] (update_goodness) [right of=reg_status,node distance=4cm] %
{update\\Goodness of Fit\\$\chi_\mathrm{red}^2$};%
\node [decision] (line_pass) [right of=update_goodness,node distance=4.5cm]%
{Is \\ $\left|\delta \right| < \left( 3.5\cdot \sigma_{\varepsilon} + %
\sigma_{\hat{\beta}_k}\right)$\\ and \\ $\chi_\mathrm{red}^2 < 1.6$};
\node [block] (update_beta_k) [right of=line_pass,node distance=5.5cm] %
{Update estimated values\\$\chi_\mathrm{red}^2$, $\hat{\beta}_k^i$ and %
$\operatorname{Cov}$};
% row 4
\node [block] (Reg_False) [below of=line_pass, node distance=2.3cm]%
{Set regression status\\equal False};
% row 5
\node [block] (create_replica) [right of=Reg_False,node distance=4cm]
{Create a replica of\\current regression solution\\$i \to i+1$};
\node [block] (Update_replica) [right of=create_replica,node distance=4cm]
{Clean buffer,\\Update:\\$\hat{\beta}_k^{i+1}$, $\operatorname{Cov}_k^{i+1}$ and %
$\chi_\mathrm{red}^2$};
% row 6
\node [decision] (i > 0 1) [below of=reg_status,node distance=4cm]
{Number\\of\\regression};
\node [block] (update estimate) [right of=i > 0 1,node distance=5cm]
{Update estimated values \\ $^{i+1}\chi_\mathrm{red}^2$, $\hat{\beta}_k^{i+1}$ and %
$\operatorname{Cov}_k^{i+1}$};
% row 7
\node [decision] (if 2) [below of=Update_replica,node distance=5cm]
{Is \\ regression solution false \\ and \\ sufficent number of measurements};
\begin{scope}[every path/.style=line]
\path [line] (start)-- (measurement);
\path [line,rounded corners] (measurement) -| (reg_status);
\path [line] (reg_status) -- node[above,midway] {True} (update_goodness);
\path [line] (reg_status) -- node[near start,right] {False} (i > 0 1);
\path [line] (update_goodness) -- (line_pass);
\path [line] (line_pass) -- node[above,midway] {Yes} (update_beta_k);
\path [line] (line_pass) -- node[right,midway] {No} (Reg_False);
\path [line] (Reg_False) -- (create_replica);
\path [line] (create_replica) -- (Update_replica);
\path [line] (i > 0 1) -- node[above,midway] {$i>0$} (update estimate);
\path [line,rounded corners] (update_beta_k.east) -| ($(if 2.east) + (0.5,0)$) |- (if 2.east);
\path [line,rounded corners] (Update_replica.east) -| ($(if 2.east) + (0.5,0)$) |- (if 2.east);
\path [line,rounded corners] (update estimate.east) -| ($(if 2.east) + (0.5,0)$) |- (if 2.east);
\path [line,rounded corners] (i > 0 1.south) |- node[above right,near start]%
{$i=0$} ($(if 2.east) + (0.5,0)$) |- (if 2.east);
\end{scope}
\end{tikzpicture}
\end{document}
这是上面的图片TeX代码返回
答案1
您可以使用节点(相对于页面的绝对位置)将tikz
图片精确地放置在页面上的任意位置。这可以通过以下代码完成current page
\documentclass{scrbook}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page.center) circle (1cm);
\end{tikzpicture}
\end{document}
如果您想要将某物精确地放置在图片内,则可以使用节点current bounding box
。使用这种方法,要将某物水平居中在页面上,您可以考虑
\documentclass{scrbook}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[]
\draw (0,0) rectangle (2,3);
\draw (1,2) rectangle (4,4);
\draw[red] (current bounding box.north) circle (1cm);
\end{tikzpicture}
\end{center}
\end{document}