2

Here was the original code, from here.

I am trying to fit it to a specific page with the following margin. Note that I need to use \ref{} to some other content in the writing. So i cant't just include like a PDF file or scale from a complied file.

I have tried to recalculate some of the boxes, but it just seems to messy now.

I wonder if there is an easier way, to scale the picture and being able to use (ref{}) some content in the new article. Thanks!

\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}

\usepackage[left=45mm,top=30mm,bottom=25mm,right=25mm,showframe]{geometry}

\usepackage{fancyhdr}      % fancy header and footer
\setlength{\headheight}{15pt}

\usepackage{rotating}      % sidewaytables

\usepackage{tikz}
\usetikzlibrary{calc}


\fancyhead{}
\fancyfoot{}
\rhead{\thepage}
\lhead{\rightmark} % or use "\leftmark"
\pagestyle{fancy}  % Finally, use the "fancy" page style to implement the FancyHdr headers

\pagenumbering{arabic}

\usepackage{hyperref}

\begin{document}

Something here, blah blah blah,
\begin{equation}
\label{eqn:abc}
x+y=z
\end{equation}


\begin{equation}
\label{eqn:abc2}
x+y=z
\end{equation}

\begin{sidewaysfigure}
\centering

\tikzstyle{mbigblock}  = [rectangle,thick, draw, text width =13cm, text centered, minimum height=1em]
\tikzstyle{block}      = [rectangle,thick, draw, text width =4cm, text centered, minimum height =1em]
\tikzstyle{mblock}     = [rectangle,thick, draw, text width =7cm, text centered, minimum height =1em]
\tikzstyle{lblock}     = [rectangle,thick, draw, text width =9cm, text centered, minimum height =1em]
\tikzstyle{rblock}     = [rectangle,thick, draw, text width =6cm, text centered, minimum height =1em]
\tikzstyle{lsmallblock}= [rectangle,thick, draw, text width =5cm, text centered, minimum height =1em]


\begin{tikzpicture}[node distance=2cm]



% middle boxes
\node (m1) [mbigblock] {Choose an exhaustive summary, $\kappa$, with $n_\theta$ parameters $\theta$};
\node (m2) [mbigblock,below of=m1,node distance=1cm] {Find the rank, $r_\theta$, of the derivative matrix $D(\theta)$};
\node (m3)  [mblock,below of=m2,node distance=1.5cm] {Model is full rank and at least locally identifiable \ref{eqn:abc}};
\node (m4)  [mblock,below of=m3,node distance=1cm] {Does the model extend?};
\node (m5)  [mblock,below of=m4,node distance=1cm] {Can the extension theorem be used?};
\node (m6)  [mblock,below of=m5,node distance=1cm] {If $D_{\text{ex}}$ is full rank, the model is full rank in general (Th3)};
\node (m7)  [block,below of=m6,node distance=1cm] {Is $r_s \geq n_\theta$?};
\node (m8l) [block,below left  of=m7,node distance=2cm,text width=4cm] {Model is full rank and at least locally identifiable \ref{eqn:abc2} };
\node (m8r) [block,below right of=m7,node distance=2cm,text width=4cm] {Model is parameter redundant and non--identifiable (Th 8b).};
\node (m9)  [block,below of=m7,node distance=3cm,text width=2cm] {Is $r_s = n_s$?};
\node (m10l) [block,below left  of=m9,node distance=2cm,text width=4cm] {Solve PDE to find a reduced--form exhaustive summary};
\node (m10r) [block,below right of=m9,node distance=2cm,text width=4cm] {$s(\theta)$ is a reduced--form exhaustive summary};





% left boxes
\node (l1) [lblock,left  of=m3,node distance=8.5cm] {Model is parameter redundant and not identifiable. There are $r_\theta$ estimable parameters. (Th2a.ii)};
\node (l2) [lblock,below of=l1,node distance=3cm] {Solve $\alpha^T D=0$ to find the set of estimable parameters, $\beta$(Th2b). \\ Let $\theta=\beta$ and find the new $D$. What follows applies to the new set of parameters, from this results for the original $\theta$ can be deduced.};
\node (l3) [lblock,below of=l2,node distance=3cm] {Write $D=PLUR$. Does Det$(U)=0$ have any solutions (for which $R$ is defined)(Th4)? If appropriate write $D_{\text{ex}}=P_{\text{ex}}L_{\text{ex}}U_{\text{ex}}R_{\text{ex}}$. Does Det$(U_{\text{ex}})=0$ have any solutions (Th6)};
\node (l4l) [lsmallblock,below left  of=l3,node distance=3cm,text width=6em] {Conditionally Full Rank};
\node (l4r) [lsmallblock,below right of=l3,node distance=3cm,text width=6em] {Essentially Full Rank};
\node (l5l) [lsmallblock,below of=l4l,text width=10em] {Determine parameter redundant submodels if appropriate};
\node (l5r) [lsmallblock,below of=l4r,text width=6em] {Test for global identifiability};


% right boxes
\node (r1) [rblock,right of=m3,node distance=9cm] {Choose a reparameterisation $s(\theta)$ of length $n_s$};
\node (r2) [rblock,below of=r1,node distance=2cm] {Rewrite $\kappa$ in terms of $s$. Find the rank $r_s$, of the derivative matrix $D(s)$};
\node (r3) [rblock,below of=r2,node distance=2cm] {Is rank$(\partial s / \partial \theta)=n_s$ ?};
\node (r4) [rblock,below of=r3,node distance=2cm,text width=3cm] {Is $r_s=n_s$ ?};
\node (r5l) [block,below left  of=r4,node distance=3cm,text width=3cm,minimum height=4em] {Solve PDE to find an exhaustive summary};
\node (r5r) [block,below right of=r4,node distance=3cm,text width=3cm,minimum height=4em] {$s(\theta)$ is an \\ exhaustive summary};


\end{tikzpicture}

\end{sidewaysfigure}

\end{document}




% Middle flows
\draw[thick,->] (m1) -- (m2) ;
\draw[thick,->] (m2) -- node[left] {$r_\theta=n_\theta$} (m3) ;
\draw[thick,->] (m3) -- (m4) ;
\draw[thick,->] (m4) -- node[left] {Yes} (m5) ;
\draw[thick,->] (m5) -- node[left] {Yes} (m6) ;

\draw[thick,->] (m7) -| node[left]  {Yes} (m8l);
\draw[thick,->] (m7) -| node[right] {No } (m8r);

\draw[thick,->] (m8l.south) -- ++(0,-0.3cm) -| (m9);
\draw[thick,->] (m8r.south) -- ++(0,-0.3cm) -| (m9);

\draw[thick,->] (m9) -| node[left]  {No}  (m10l);
\draw[thick,->] (m9) -| node[right] {Yes} (m10r);



% Right flows
\draw[thick,->] (r1) -- (r2) ;
\draw[thick,->] (r2) -- (r3) ;
\draw[thick,->] (r3) -- node[right] {No}(r4) ;
\draw[thick,->] (r4) -| node[left]  {No}  (r5l);
\draw[thick,->] (r4) -| node[right] {Yes} (r5r);


% Left flows
\draw[thick,->] (l1) -- (l2) ;

\draw[thick,->] (l3.south) - ++ (0,-0.4cm) -| node[left]  {Yes} (l4l);
\draw[thick,->] (l3.south) - ++ (0,-0.4cm) -| node[right] {No } (l4r);

\draw[thick,->] (l4l) -- (l5l) ;
\draw[thick,->] (l4r) -- (l5r) ;


% Middle to left
\draw[thick,->] (m2.west) -| node[left] {$r_\theta<n_\theta$} (l1.north) ;
\draw[thick,->]
    (m4.west) -- node[below] {No}
    ++(-1.5cm,0) |-
    (l3.east)
    ;
\draw[thick,->] (m6.west) -- ++(-1.5cm,0);


% Middle to right
\draw[thick,->] (m2.east) -| node[above] {Cannot find rank} (r1.north) ;
\draw[thick,->] (m5.east) 
    -- ++(1.0cm,0) node[below] {No}
    |- (r1.west)
    ;

% Left to middle
%\coordinate (l2tom3) at ($(m3.south)+(0,-0.3cm)$);
\draw[thick,->]
    (l2.east) 
    -- ++(1.0cm,0) 
    |- ($(m3.south)+(0,-0.5cm)$) %(l2tom3)
    ;

% Right to middle
\draw[thick,->] (r3.west) -|  (m7.north) ;
\draw[thick,-] (r3.west) -- node[above] {Yes} ++ (-4.0cm,0) ;


%% Draw the outer lines
%\coordinate (Above m1) at ($(m1.north)+(0,1.0cm)$);

\draw[thick, red]  (m10r.south) -- ++ (0,-0.5cm);
\draw[thick, red]  (r5l.south) -- ++ (0,-0.5cm);
\draw[thick, red]  (r5r.south) -- ++ (0,-0.5cm);

\draw[thick, blue, ->]  
    (m10l.south) 
    -- ++ (0,-0.5cm)
    -- ++ (13.5cm,0)
    |- ($(m1.north)+(0,0.5cm)$)
    -- (m1.north)
    ;
  • you could do something like \begin{tikzpicture}[scale=0.7,font=\footnotesize] but your output still gets kinda messy... – Holene Oct 28 '14 at 21:59
  • @Holene Yes, I tried. But the texts and coordinates need to be recalculated each individually. I have updated my code, to re-position my boxes. – Chen Stats Yu Oct 28 '14 at 22:20
  • What is the point of the code following \end{document} exactly? – cfr Oct 28 '14 at 22:48
  • 1
    Perhaps it would be easier to solve the cross-reference problem rather than the scaling one? That is, there are ways of getting LaTeX to use references to an external document for cross-referencing purposes. Then you could just include it as a PDF/graphic or whatever. See, for example, http://ctan.org/pkg/xr. – cfr Oct 28 '14 at 22:54
  • @cfr I think it's still a bit complicated then that. My main file is call main.tex, and in folder Chapt has files chap1.tex,chap2.tex,chap3.tex,ect. I tried compiling main.tex first, then use the fig.tex(this figure). It did not work. – Chen Stats Yu Oct 28 '14 at 23:08

0 Answers0