Without using the include graphic, placing directly within the text a design using TikZ, you can control the size of the figure?
[Tex/LaTex] How to control the size of the figure
tikz-pgf
Related Solutions
The pgf/TikZ manual suggests using the command \pgftext
to insert external graphics (section 53.3.3 "Inserting Text and Images"). Here's an example taken from this seminar (slides 5 and 6 in the presentation version):
\begin{figure}
\begin{tikzpicture}
\pgftext{%
\includegraphics[width=\textwidth]{Bridge05a}%
}%
\node[fill=black, opacity=.5, text opacity=1] at (0,.5) {\Large \color{yellow} Geometry};
\node[fill=black, opacity=.5, text opacity=1] at (0,-.5) {\Large \color{red} \emph{Manifolds}};
\node[fill=black, opacity=.5, text opacity=1] at (-4,.5) {\Large \color{yellow} Algebra};
\node[fill=black, opacity=.5, text opacity=1] at (4,.5) {\Large \color{yellow} Analysis};
\end{tikzpicture}
\end{figure}
There is also a hint elsewhere in the manual (in 53.3.1) that the command \pgfimage
can be used instead of \includegraphics
(although still within the \pgftext
command); however, searching for \pgfimage
in the manual doesn't turn up any further explanation of this command.
The \pgftext
command is something of a special command. It "escapes" out of the current picture back to "normal TeX". It is, therefore, somewhat like a \node
command. It works by constructing a box which is then put into the picture. By default this box is put at the current origin. A simple way to move it, therefore, is to (temporarily) tell TikZ/PGF to move the origin priori to issuing the \pgftext
command.
An alternative way of positioning it is to use the initial optional argument. Thus one can say \pgftext[<positioning information>]{text}
where <positioning information>
is some set of PGF keys that relocate the box. These are similar to the positioning of a \node
, but have a slightly "low level" feel to them. For example, to locate the box at a particular point one would say \pgftext[at={\pgfpoint{1cm}{2cm}}]{text}
. Note the \pgfpoint
syntax rather than the TikZ coordinate syntax.
In the 2.10-CVS version of the manual, the \pgftext
command is documented in Section 77.3.3. There is also some important information about how it interacts with scopes in Section 77.1.2 (note especially item 5 about the ability to put another pgfpicture
inside a \pgftext
command, something that should never be done with \node
!).
In summary, \pgftext
is somewhat akin to \node
in that it allows you to put "normal TeX" in your picture. However, the two are different in that a \node
is considered part of the picture but \pgftext
is for things that are meant to be somewhat separate.
Use the preview
package with tightpage,active
options to only display elements you want as single pages. You need to wrap the tikzpicture
in preview
environments or declare it as \PreviewEnvironment{tikzpicture}
.
The standalone
class gives you exactly this functionality in a very short form:
\documentclass[class=minimal,border=0pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\clip (0,0) rectangle (1,1);
\draw[red] (0,0) -- (1,1);
\draw[red] (1,0) -- (0,1);
\draw[blue] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{document}
(Dark border is the PDF viewer background and not part of the PDF)
You then can load the standalone
package (!) in a document and simply \input
this file. The preamble and document
environment will be automatically striped.
Note:
You are currently clipping at the center of the blue rectangle and cutting it in half. You need to add half the line with on each side of the clipping path:
\clip (-.5\pgflinewidth,-.5\pgflinewidth) rectangle ([shift={(.5\pgflinewidth,.5\pgflinewidth)}]1,1);
Best Answer
Use the
scale
-Option, such asor the short syntax, which is convenient for small images within text:
To apply that scaling also to contained shapes, you may want to add the corresponding option:
As cfr already commented, you can use the LaTeX scaling tools, such as
\scalebox
and\resizebox
. Both have the advantage of scaling all easily, but note that scaling fonts is not so good compared to directly using the font in a certain size. With\resizebox
you can directly specify the desired size instead of a scaling factor.