Graphics, Figures & Tableshow craete a new command to center figure with caption

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
allevo
Posts: 49
Joined: Sat Apr 11, 2009 12:09 pm

how craete a new command to center figure with caption

Post by allevo »

hi!!
I'd like put centre a figure with its caption sideways.
i wrote this:

Code: Select all

\documentclass{book}
%central fig command
\newcommand{\centrefig}[2]
{
 \begin{tabular}[t]{rr}
  \includegraphics{#1} & #2
 \end{tabular}
}

\begin{document}
\centrefig{img_esempi/lion}{foo}
\end{document}
but it create an error (! Undefined control sequence)
where am i wrong?!?!

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

how craete a new command to center figure with caption

Post by frabjous »

You need to have something like:

\usepackage[dvips]{graphicx}


or

\usepackage[pdftex]{graphicx}

in your document header to use \includegraphics. (What kind of image file are you using, and what kind of output are you trying to make?)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: how craete a new command to center figure with caption

Post by Stefan Kottwitz »

Hi,

just a remark, \usepackage{graphicx} would be sufficient, the driver should be detected automatically. That's better than to pass a wrong option accidentally.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

how craete a new command to center figure with caption

Post by localghost »

allevo wrote:[...] I'd like put centre a figure with its caption sideways. [...]
For standard classes take a look at the floatrow or the sidecap package. Other classes may have built-in features.


Best regards
Thorsten
allevo
Posts: 49
Joined: Sat Apr 11, 2009 12:09 pm

Re: how craete a new command to center figure with caption

Post by allevo »

thank but the text is the text is below...
Attachments
prova.pdf
(14.44 KiB) Downloaded 249 times
Post Reply