Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a figure, created in MS Visio, a PDF figure. I have added text to the figure using qtix. The code is pasted below:

\begin{tikzpicture}[scale=0.30]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node at (8,-0.5) {Ground};
\node at (-0.5,-0.5) {Ground};
\node at (-9,-0.5) {Ground};

\node at (14.5,9.1) {Public grid; phase A};
\node at (14.5,8.3) {phase A};
\node at (14.5,7.5) {phase B};
\node at (14.5,6.7) {phase C};

\node at (14.5,2.3) {Railway grid};
\node at (14.5,1.5) {catenary};
\node at (14.5,0.7) {rail/ground};

\node at (11.5,3.8) {Transformer};
\node at (3.0,3.8) {Transformer};
\node at (-5.5,3.8) {Transformer};

\end{tikzpicture}

The figure is more landscape-shaped, so I want to rotate the figure in my document. The figure is attached below.

The problem is I dot now know how to rotate figures that are inserted by the \input command. The \includegraphics command can use rotation, but then each text also need to be rotated. And when doing that, the centering of the image fails. I have tried that too. See the code below:

\begin{tikzpicture}[rotate=90,scale=0.32]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node[rotate=90] at (8,-0.5) {Ground};
\node[rotate=90] at (-0.5,-0.5) {Ground};
\node[rotate=90] at (-9,-0.5) {Ground};

\node[rotate=90] at (14.5,9.1) {Public grid; phase A};
\node[rotate=90] at (14.5,8.3) {phase A};
\node[rotate=90] at (14.5,7.5) {phase B};
\node[rotate=90] at (14.5,6.7) {phase C};

\node[rotate=90] at (14.5,2.3) {Railway grid};
\node[rotate=90] at (14.5,1.5) {catenary};
\node[rotate=90] at (14.5,0.7) {rail/ground};

\node[rotate=90] at (11.5,3.8) {Transformer};
\node[rotate=90] at (3.0,3.8) {Transformer};
\node[rotate=90] at (-5.5,3.8) {Transformer};


\end{tikzpicture}

The main document part of my code looks like:

\begin{figure}
    \centering
    \input{Visioritning2.pgf}
    \caption{A simplified illustration of how the three-phase grid commonly feeds the railway when using substation transformers}
    \label{Figure:SimplifiedTransformerSubstation}
\end{figure}

So any suggestions of what I should do? The main problem is:

  • How to both rotate and center a PGF-created PDF-based figure with added explanatory text on it?
  • Is it preferable to to the rotation in PGF-code or is it better to do it in the, or before the \input statement?
share|improve this question
    
Hi Lars, welcome to TeX.sx! I've edited your question a bit: Inline code snippets can be formatted by enclosing them in backticks (or selecting them and clicking the {} button). I've also inserted your image, and removed the closing, to keep with the format of this site. –  Jake Mar 29 '12 at 15:46
    
Not sure if I understand your needs correctly. General material (text and/or images) can be rotated using \rotatebox{<angle>}{<content>} from the graphicx package (already loaded by tikz). \centering should center it, at least relative to its official size. Try to avoid having whitespace around your real content. You should crop the PDF first using pdfcrop for example. –  Martin Scharrer Mar 29 '12 at 15:55
3  
This looks also like a good usecase of standalone. The v1.0 version provides \includestandalone[<options, incl. angle>]{<code file, like your .pgf>}. –  Martin Scharrer Mar 29 '12 at 15:56
    
@MartinScharrer: I think this is an answer ;-) –  Marco Daniel Apr 9 '12 at 9:15
add comment

1 Answer 1

You can rotate general material, like your whole picture, using the \rotatebox{<angle>}{<content>} macro from the standard graphicx package (already loaded by TikZ anyway), e.g. try \rotatebox{90}{\input{<filename>}}.

This looks also like a good use-case of standalone. The v1.0 version provides \includestandalone[<options, incl. angle>]{<code file, like your .pgf>}. This also allows you to compile the picture on its own, which is very nice during its creation process.


% Visioritning2.tex
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=0.30]
\pgftext{\includegraphics{TransformerSubstationFeeding}}

\small

\node at (8,-0.5) {Ground};
\node at (-0.5,-0.5) {Ground};
\node at (-9,-0.5) {Ground};

\node at (14.5,9.1) {Public grid; phase A};
\node at (14.5,8.3) {phase A};
\node at (14.5,7.5) {phase B};
\node at (14.5,6.7) {phase C};

\node at (14.5,2.3) {Railway grid};
\node at (14.5,1.5) {catenary};
\node at (14.5,0.7) {rail/ground};

\node at (11.5,3.8) {Transformer};
\node at (3.0,3.8) {Transformer};
\node at (-5.5,3.8) {Transformer};

\end{tikzpicture}
\end{document}

% Main document
\documentclass{article}% or any other
\usepackage{tikz}
\usepackage{standalone}
\begin{document}
% ...
\begin{figure}
    \centering
    \includestandalone[angle=90]{Visioritning2}
    \caption{A simplified illustration of how the three-phase grid commonly feeds the railway when using substation transformers}
    \label{Figure:SimplifiedTransformerSubstation}
\end{figure}
% ...
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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