3

I'm creating tikz UML diagrams using the standalone package to draw them separately without compiling my whole document to see of the image looks correct.

I'm using tikzEdt (www.tikzedt.org) to create the image and the \includestandalone{"path to tex file"} to insert it into my document. My problem is that the image positioning in tikzEdt seems to be adjusted upon inclusion into the whole document. To illustrate: The tikzEdt output: tikzEdt output

and code:

\documentclass{standalone}

\usepackage{tikz-uml}
\begin{document}

%\thispagestyle{empty}

\begin{tikzpicture}[x=1cm,y=1cm] 

% loads
\umlclass[type = Abstract, y=-2.5]{Loads}{
  $Name$\\  
  $Load$ $case$ $name$\\  
  $Node$\\  
  $Degree$ $of$ $freedom$\\ 
  $Magnitude$
}{$Copy$ $functionality$}

\umlclass[x=-5, y=-2]{PointLoad}{ 
  $DOF = 1 -3$
}{$Copy$ $functionality$}

\umlclass[x=-5, y=-5]{PointMoment}{
  $DOF = 4 -6$
}{$Copy$ $functionality$}

\umlclass[x=0, y=-8]{LineLoad}{
    $Name$\\  
  $Load$ $case$ $name$\\  
  $Direction$\\  
  $Element$\\ 
  $Magnitude$
}{$Copy$ $functionality$\\
   $Divide$ $into$ $PointLoads$\\ 
   $Divide$ $into$ $PointMoments$
}

% connectors

\umlinherit[]{Loads}{PointLoad}
\umlinherit[]{Loads}{PointMoment}

%% Load cases
\umlclass[x=5, y=-2]{LoadCase}{
   $Name$\\  
  $Loads$\\  
  $LineLoads$\\  
  $Resutling$ $reactions$\\ 
  $Resutling$ $displacements$\\ 
}{$Copy$ $functionality$}

\umlclass[x=5, y=-7]{LoadCombination}{
   $Load$ $cases$\\  
  $Loads$\\  
  $LineLoads$\\  
  $Resutling$ $reactions$\\ 
  $Resutling$ $displacements$\\  
}{$Copy$ $functionality$}

% connectors

\umlinherit[]{LoadCase}{LoadCombination} 

%% Manager
\umlclass[x=0, y=2]{LoadManager}{
   $Load$ $cases$\\  
  $Load$ $combinations$\\
}{$Copy$ $functionality$}

\end{tikzpicture}

\end{document}

While once compiled in my main document it looks like thisdocument output

I included it with this code:

\begin{figure}[H]
\centering
\includestandalone{Software_implementation/loadsUML}
%Hello figure!
\caption{UML diagram illustrating the loads package}
\label{fig: loadsUML}
\end{figure}

Any idea why this happens? I tried specifying the tikz units, but it didn't seem to work.

EDIT: A MWE to show what happens (Its caused by font size)

%\documentclass[]{article}
\documentclass[12pt]{article} % produces "squishing"

%% Latex bib package
\usepackage[backend=biber]{biblatex} % using biber build

\usepackage{float}
\usepackage[subpreambles=true]{standalone} % outsource figure to their own files


\begin{document}

\begin{figure}[H]
\centering
\includestandalone{loadsUML}
\caption{UML diagram illustrating the loads package}
\label{fig: loadsUML}
\end{figure}

\end{document}

How can this be fixed?

3
  • You can find the tikz-uml.sty link I tried using the [mode=image] as suggested, but unfortunately it didn't make a difference
    – Theo
    May 18, 2017 at 14:06
  • Your code works for me. Could you include the code for the final document. Your figure environment is not enough to reproduce the error.
    – Ignasi
    May 18, 2017 at 15:18
  • @Ignasi I narrowed it down to font size. I am currently using 12pt. If I remove it the image shows correctly, otherwise the "squishing" is still present. Any idea how to fix this? I will add a MWE to the question
    – Theo
    May 18, 2017 at 17:47

1 Answer 1

1

Turns out, I was creating my tikz drawing using a different font size than my document. The issue can be resolved by specifying the font size in the first line of the tikz drawing's file. i.e. \documentclass[12pt]{standalone}. Now I can create my figures exactly as they will appear in the document (If they are not too wide that is).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .