
我希望箭頭之間的節點中的文字居中而不是左對齊。使用\centering
或\begin{center} ... \end{center}
圍繞小型頁面或text align=center
tikzpicture 選項中的設定沒有幫助。我在中找不到進一步的指導圖式包裹。 (我願意接受不涉及此包的解決方案。)
\documentclass{article}
\usepackage{tikz,xcolor, fontspec, schemata}
\usetikzlibrary{shapes,arrows,positioning, decorations.pathreplacing}
\setmainfont{Arial}
\begin{document}
\tikzstyle{block}=[align=center]
\tikzstyle{line} = [draw,-latex',ultra thick]
\begin{tikzpicture}[node distance = 5em,auto,block]
\node (prior-lit) {Prior literature};
\node [below of=prior-lit] (aims-12)
{
\begin{minipage}{\columnwidth}
\let\SB\schemabox
\schema{\SB{Aims 1 \& 2}}{\SB{\textbf{Identify} Risk and protective factors for \\ nonmedical poly- and monosubstance use\\ location, position in social network, age, gender}}
\end{minipage}
};
\node [below of=aims-12, below=0em] (mock-intervention)
{
\begin{minipage}{\columnwidth}
\let\SB\schemabox
\schema{\SB{Aim 3}}{\SB{\textbf{Simulate} responses of users with various \\ combinations of risk and protective factors\\ to interventions on social networking sites}}
\end{minipage}
};
\node [below of=mock-intervention] (real-intervention) {Real intervention};
\node [below of=real-intervention] (outcomes) {Asses outcomes};
\path[line] (prior-lit) -- (aims-12);
\path[line] (aims-12) -- (mock-intervention);
\path[line, dashed] (mock-intervention) -- (real-intervention);
\path[line, dashed] (real-intervention) -- (outcomes);
\draw [decorate,decoration={brace,amplitude=1em,mirror,raise=4pt},yshift=-10] (5.5,-5) -- (5.5,0) node [right,black,midway,xshift=2em] {\textbf{Current grant}};
\draw [decorate,decoration={brace,amplitude=1em,mirror,raise=4pt},yshift=-10] (5.5,-8) -- (5.5,-5.1) node [right,black,midway,xshift=2em] {\textbf{Future grants}};
\end{tikzpicture}
\end{document}
答案1
像這樣?
箭頭以整個節點為中心。我用了一個tabular
裡面\SB
:
\documentclass{article}
\usepackage{tikz,xcolor, fontspec, schemata}
\usetikzlibrary{shapes,arrows,positioning, decorations.pathreplacing}
\setmainfont{Arial}
\begin{document}
\tikzset{block/.style={align=center},
line/.style = {draw,-latex',ultra thick}}
\begin{tikzpicture}[node distance = 5em,auto,block]
\node (prior-lit) {Prior literature};
\node [below of=prior-lit] (aims-12)
{
% \begin{minipage}{\columnwidth}
\let\SB\schemabox
\schema{\SB{Aims 1 \& 2}}{\SB{\begin{tabular}{@{}c@{}}\textbf{Identify} Risk and protective factors for \\ nonmedical poly- and monosubstance use\\ location, position in social network, age, gender\end{tabular}}}
% \end{minipage}
};
\node [below of=aims-12, below=0em] (mock-intervention)
{
% \begin{minipage}{\columnwidth}
\let\SB\schemabox
\schema{\SB{Aim 3}}{\SB{\begin{tabular}{@{}c@{}}\textbf{Simulate} responses of users with various \\ combinations of risk and protective factors\\ to interventions on social networking sites\end{tabular}}}
% \end{minipage}
};
\node [below of=mock-intervention] (real-intervention) {Real intervention};
\node [below of=real-intervention] (outcomes) {Asses outcomes};
\path[line] (prior-lit) -- (aims-12);
\path[line] (aims-12) -- (mock-intervention);
\path[line, dashed] (mock-intervention) -- (real-intervention);
\path[line, dashed] (real-intervention) -- (outcomes);
\draw [decorate,decoration={brace,amplitude=1em,mirror,raise=4pt},yshift=-10] (5.5,-5) -- (5.5,0) node [right,black,midway,xshift=2em] {\textbf{Current grant}};
\draw [decorate,decoration={brace,amplitude=1em,mirror,raise=4pt},yshift=-10] (5.5,-8) -- (5.5,-5.1) node [right,black,midway,xshift=2em] {\textbf{Future grants}};
\end{tikzpicture}
\end{document}