3

I am trying to fit a tikz image into a poster without success. The image itselft is correct, but when I try to import the file into the poster, writing

 \begin{figure}[htbp]
  %\resizebox{\columnwidth}{!}{
    \input{./Architecture.tex}%}
    \caption{Architecture of the NCS \label{fig:NCS_Architecture}}
 \end{figure}

the output is like this:

enter image description here

Is there any problem on the scaling maybe? I would really glad if somebody can help me with this!

Thanks

Code of my image:

\tikzstyle{block} = [draw, fill=blue!20, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]


\begin{tikzpicture}[auto, node distance=2cm,>=latex']

\node [input, name=input] {};
\node [sum, right of=input] (sum) {};
\node [block, right of=sum] (controller) {Controller};
\node [block, right of=controller, pin={[pinstyle]above:Disturbances},node distance=3cm] (system) {System};

\draw [->] (controller) -- node[name=u] {$u$} (system);
\node [output, right of=system] (output) {};
\node [block, below of=u] (measurements) {Measurements};

\draw [draw,->] (input) -- node {$r$} (sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (system) -- node [name=y] {$y$}(output);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {$-$} node [near end] {$y_m$} (sum);
\end{tikzpicture}

and the document of the poster:

\documentclass{sciposter}
\usepackage{lipsum}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{graphicx,url}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\tikzstyle{block} = [draw, fill=blue!20, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\newtheorem{Def}{Definition}
\newtheorem{theorem}{Theorem}

\title{TITLE}

\author{authors}

\begin{document}
\maketitle

%%% Begin of Multicols-Enviroment
\begin{multicols}{3}

%%% Abstract
\begin{abstract}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{abstract}

%%% Introduction
\section{Introduction}
\label{introduction}
\begin{figure}[htbp]
 %  \resizebox{\columnwidth}{!}{
    \input{./Architecture.tex}%}
 \caption{Architecture of the NCS \label{fig:NCS_Architecture}}
 \end{figure}

 \section{Setup}
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.


   \newcommand{\imsize}{0.45\columnwidth}



 \end{multicols}

 \end{document}
  • 1
    Can you provide code for your image? Even better, small complete document with your image, which we can compile? – Zarko Mar 8 '17 at 9:48
  • In the link i shared a simple example of my document, you can see the Architecture.tex file and the main.tex which you can compile – Betelgeuse Mar 8 '17 at 9:50
  • 1
    please, help us to help you! instead of link to code, which doesn't contain image code and require, we need here, in your question, small, complete document, which will contain image code and some dummy text. It seems, that problem is in your image, but this is pure guessing. To confirm this, We need what I asked you already twice :-) – Zarko Mar 8 '17 at 10:00
  • Can you show an example where your image works correctly? With \documentclass[tikz]{standalone} \begin{document} \input{./Architecture.tex} \end{document} it looks the same. – samcarter_is_at_topanswers.xyz Mar 8 '17 at 10:09
  • 1
    @Betelgeuse Another option would be to express tikz dimensions always in "em", which scale correctly with the font size. – JLDiaz Mar 8 '17 at 10:32
5

The problem is due to the use of cm as unit in the tikz picture. Because beamerposter uses huge font sizes, the boxes are too large and 2cm of separation between their centers if not enough to avoid overlapping.

A solution can be to express the distances between nodes in em which is a dimension which depends on the font size. Changing your code to use 3em for each original cm:

\documentclass{beamer}
\usepackage[orientation=portrait,size=a0,scale=1.6,debug]{beamerposter}                       

\usepackage{tikz}
\begin{document}
\tikzstyle{block} = [draw, fill=blue!20, rectangle, 
minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=3em]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=6em]
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right of=input] (sum) {};
\node [block, right of=sum] (controller) {Controller};
\node [block, right of=controller, pin={[pinstyle]above:Disturbances},
node distance=9em] (system) {System};
% We draw an edge between the controller and system block to 
% calculate the coordinate u. We need it to place the measurement block. 
\draw [->] (controller) -- node[name=u] {$u$} (system);
\node [output, right of=system] (output) {};
\node [block, below of=u] (measurements) {Measurements};

% Once the nodes are placed, connecting them is easy. 
\draw [draw,->] (input) -- node {$r$} (sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (system) -- node [name=y] {$y$}(output);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {$-$} 
node [near end] {$y_m$} (sum);
\end{tikzpicture}
\end{document}

The result looks ok:

Result

Update

A second posibility is to use tikz's positioning library. Using this library the syntax of relative positioning changes from right of=sum to right=of sum, etc. and then the distance between nodes is intelligently considered by tikz as distances between node edges, not centers, thus avoiding overlapping.

Using this approach (and reverting distances to cm again, instead of em) the code would be:

\documentclass{beamer}
\usepackage[orientation=portrait,size=a0,scale=1.6,debug]{beamerposter}                       
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikzstyle{block} = [draw, fill=blue!20, rectangle, 
minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=3cm]
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right=of input] (sum) {};
\node [block, right=of sum] (controller) {Controller};
\node [block, right=of controller, pin={[pinstyle]above:Disturbances},
node distance=3cm] (system) {System};
% We draw an edge between the controller and system block to 
% calculate the coordinate u. We need it to place the measurement block. 
\draw [->] (controller) -- node[name=u] {$u$} (system);
\node [output, right=of system] (output) {};
\node [block, below=of u] (measurements) {Measurements};

% Once the nodes are placed, connecting them is easy. 
\draw [draw,->] (input) -- node {$r$} (sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (system) -- node [name=y] {$y$}(output);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {$-$} 
node [near end] {$y_m$} (sum);
\end{tikzpicture}
\end{document}

And the result (a bit more compact this time):

Result2

|improve this answer|||||
  • The problem was indeed the use of cm instead of em. Thanks, now it´s scaled! – Betelgeuse Mar 8 '17 at 10:49
  • 1
    @Betelgeuse See the update for another possibility – JLDiaz Mar 8 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.