Graphics, Figures & TablesTikz Picture and \begin{figure}

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Tikz Picture and \begin{figure}

Post by coachbennett1981 »

With the following code I want to be able to label the graph as a figure (sequential with a dozen or so other graphs-all single pics)

Code: Select all

\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{multicol}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,backgrounds}
\usepackage[font=small,labelsep=none]{caption}


\begin{document}

\begin{multicols}{2}{


\begin{tikzpicture}
\draw [line width=1.5pt] (0,0) -- (60:3) -- (3,0) -- cycle;
\draw (.55,.25) node{$60^{\circ}$};
\draw (2.45,.25) node{$60^\circ$};
\draw (1.5,1.9 ) node {$60^{\circ}$};
\end{tikzpicture}

\vspace{2in}
\begin{tikzpicture}[scale=1.5]
\draw [line width=1.5pt] (0,0) -- (60:3) -- (3,0) -- cycle;
\draw (.4,.2) node{$60^{\circ}$};
\draw (2.6,.2) node{$60^\circ$};
\draw (1.5,2.2 ) node {$60^{\circ}$};
\end{tikzpicture}
}
\end{multicols}

\end{document}

Is there a way they figures can be closer together and be labeled using the \begin{figure} command? I thought about subfigures, etc.

Nick
Last edited by coachbennett1981 on Thu Dec 16, 2010 8:07 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Tikz Picture and \begin{figure}

Post by west.logan »

Apparently there is a problem with using the \begin{figure} command within a multicol environment. The following webpage has a fix for it, though I wish there were something a little more elegant.

http://www-h.eng.cam.ac.uk/help/tpl/tex ... _hint.html
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Tikz Picture and \begin{figure}

Post by torbjorn t. »

Not sure I understand exactly what you want to do. You mention subfigures, so have you considered a package like subfig:

Code: Select all

\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,through,backgrounds}
\usepackage[font=small,labelsep=none]{caption}

\usepackage{subfig}


\begin{document}

\begin{figure}
\subfloat[A triangle]{%
\begin{tikzpicture}
\draw [line width=1.5pt] (0,0) -- (60:3) -- (3,0) -- cycle;
\draw (.55,.25) node{$60^{\circ}$};
\draw (2.45,.25) node{$60^\circ$};
\draw (1.5,1.9 ) node {$60^{\circ}$};
\end{tikzpicture}
}
\subfloat[A larger triangle]{%
\begin{tikzpicture}[scale=1.5]
\draw [line width=1.5pt] (0,0) -- (60:3) -- (3,0) -- cycle;
\draw (.4,.2) node{$60^{\circ}$};
\draw (2.6,.2) node{$60^\circ$};
\draw (1.5,2.2 ) node {$60^{\circ}$};
\end{tikzpicture}
}
\end{figure}
\end{document}
Also, the caption-package, that you load already, provides the command \captionof, that allows you to have figure-captions outside of figure-environments. See the manual for caption-package.
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Tikz Picture and \begin{figure}

Post by coachbennett1981 »

Thanks, that looks great!
Post Reply