TransWikia.com

Adjust tikz-figure as a subfile on the text width (svjour3 template)?

TeX - LaTeX Asked on February 20, 2021

I have to use the svjour3 document style. In my document, I need to include a fault tree which I created in a different file/chapter.
My problem: Unfortunately, the tree is not adjusted to the normal width of the document/text width (see picture)

enter image description here

This is my current code:

documentclass[smallextended]{svjour3}       

usepackage{tikz}
usetikzlibrary{matrix,calc,circuits,calc,arrows,positioning}
usetikzlibrary{circuits.logic.US} 
usepackage{tikz-timing}
defdegr{${}^circ$}

usepackage{subfiles}
usepackage{blindtext}

begin{document}

blindtext  
subfile{Chapters/extension fault tree}
blindtext
    
end{document}

I tried things like subfile[width=textwitdh]{...} but it didn’t work….does anyone can help me? I would be extremely thankful! 🙂 Cheers!

Edit:
code of the tree:

documentclass[../template.tex]{subfiles}

begin{document}

begin{tikzpicture}
 [
% Gates and symbols style
    and/.style={and gate US,thick,draw,fill=orange!60,rotate=90,
        anchor=east,xshift=-1mm},
    or/.style={or gate US,thick,draw,fill=blue!60,rotate=90,
        anchor=east,xshift=-1mm},
    be/.style={circle,thick,draw,fill=green!60,anchor=north,
        minimum width=0.7cm},
    tr/.style={buffer gate US,thick,draw,fill=purple!80,rotate=90,
        anchor=east,minimum width=0.8cm},
% Label style
    label distance=3mm,  every label/.style={blue},
% Event style
    event/.style={rectangle,thick,draw,fill=yellow!20,text width=2cm, text centered,font=sffamily,anchor=north},
% Children and edges style
    edge from parent/.style={very thick,draw=black!70},
    edge from parent path={(tikzparentnode.south) -- ++(0,-1.05cm)-| (tikzchildnode.north)},
    level 1/.style={sibling distance=4cm,level distance=1.5cm, growth parent anchor=south,nodes=event},
    level 2/.style={sibling distance=3cm, level distance=1.5cm},
    level 3/.style={sibling distance=2.5cm, level distance=1.5cm},
    level 4/.style={sibling distance=3cm}
    ]
%% Draw events and edges
 node (g1) [event] {Extension failure  E0}
        child{node (e1) {Locks (Le)} 
            child {node (e11) {Door Lock  (DL)}
                    %child {node (e111) {Door Lock  (E11)}}
                    %child {node (e112) {Door Lock  (E11)}}
                   % child {node (e113) {Shuttle Valve  (E11)}}
            }
            child {node (e12) {Uplock  (UL)}
                    %child {node (e121) {Leak  (E11)}}
                    %child {node (e122) {Fail to close  (E11)}}
                   %child {node (e123) {Shuttle Valve  (E11)}}
            }
        } 
        child [level distance=50mm] {node (e2) {Pressure Supply (PSe)}
            child [sibling distance=8cm] {node (e21) {Main System (PSMe)}
                child {node (e211) {Lose of pressure (HPe1)}}
                child {node (e212) {Valve fails to open (IVe)}}
                child {node (e213) {Wrong position (SVe)}}
            }
            child [sibling distance=8cm] {node (e22) {Emergency System (PSEe)}
                child {node (e221) {Lose of pressure (HPe2)}}
                child {node (e222) {Shuttle Valves (SHUV)}
                     child {node (e2221) {SHUVe1a}}
                     child {node (e2222) {SHUVe1b}}
                     child {node (e2223) {SHUVe1c}}
                     child {node (e2224) {SHUVe1d}}
                }
                child {node (e223) {Valve fails to open (EVe)}}
            }    
        }
        child{node (e3) {Actuators (A)} 
            child {node (e31) {Door   (DA)}}
            child {node (e32) {MLG  (RA)}}
        }
        child {node (e4) {Pipe Blockage  (HPe)}
        };
       
%  Remove what follows if no gates are required
   node [or]   at (g1.south)   []  {};
   node [or]   at (e1.south)   []  {};
   node [and]  at (e2.south)   []  {};
   node [or]   at (e3.south)   []  {};
   node [be]   at (e4.south)   []  {};
   node [tr]   at (e11.south)  []  {};
   node [tr]   at (e12.south)  []  {};
   node [or]   at (e21.south)  []  {};
   node [or]   at (e22.south)  []  {};
   node [tr]   at (e31.south)  []  {};
   node [tr]   at (e32.south)  []  {};
   node [be]   at (e211.south)  []  {};
   node [be]   at (e212.south)  []  {};
   node [be]   at (e213.south)  []  {};   
   node [be]   at (e221.south)  []  {};
   node [or]   at (e222.south)  []  {};
   node [be]   at (e223.south)  []  {};
   node [be]   at (e2221.south)  []  {};
   node [be]   at (e2222.south)  []  {};
   node [be]   at (e2223.south)  []  {};
   node [be]   at (e2224.south)  []  {};
end{tikzpicture}
begin{tikzpicture} 
    [
    tr/.style={buffer gate US,
        thick,
        draw,
        fill=purple!80,
        rotate=90,
        inner sep=0pt,
        outer sep=0pt,
        minimum width=0.8cm},
    event/.style={rectangle,
        thick,
        draw,
        fill=yellow!20,
        text width=2cm, 
        text centered,
        font=sffamily,
        anchor=north
    },
        be/.style={circle,thick,draw,fill=green!60,anchor=north,
        minimum width=0.7cm},
        or/.style={or gate US,thick,draw,fill=blue!60,rotate=90,
        anchor=east,xshift=-1mm},
    ]
    node (g1) [tr] {};
    draw[line width=1pt] ($(g1.south)+(-3pt,6pt)$) --++(0.5cm,0pt) --+(0,-2cm)
    node[below,event] (b){DLe1/ULe1  DAe1/Rae2};

    node[event, left=of b] (c){DLe2/ULe2  Dae2/Rae1};
    node[event, right=of b] (d){SHUVe2 a/b/c/d};
    draw[line width=1pt] ($(b.north)+(0pt,6pt)$) -|(c);
    draw[line width=1pt] ($(b.north)+(0pt,6pt)$) -|(d);
    
    node [or]   at (g1.west)   [above=of b, yshift=-0.3cm]  {};
    node [be]   at (b.south)   []  {};
    node [be]   at (c.south)   []  {};
    node [be]   at (d.south)   []  {};
end{tikzpicture}

end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP