1

I am a LaTeX newbie working on creating my first custom LaTeX class. I would like to know if it's possible to define parameters for \includegraphics such as width, height, center/right align etc in the custom class, so that I don't have to retype all this for each of the image that I insert.

Werner
  • 603,163
pyro
  • 45
  • \includegraphics does not provide center or right align keys. What are you referring to specifically regarding this horizontal alignment? This may be something to do with a figure environment? – Werner Feb 19 '13 at 07:02
  • What I meant was, is there a way to ensure that each of the image that I insert in the document is always of a particular size, and always aligned right? – pyro Feb 19 '13 at 07:06

1 Answers1

1

In an attempt to be consistent with your way of writing, consider following the approach in Consistent typography by wrapping your desired inputs in a macro. Something like:

\newcommand{\mygraphic}[2][,]{% \mygraphic[<opt args>]{<file>}
  \includegraphics[width=\linewidth,height=50pt,#1]{#2}}%

To this you can add \centering or \raggedleft (for right alignment) or \raggedright (for left alignment), perhaps grouped, depending on the exact usage of \mygraphics.

In particular, the above definition \mygraphic[<opt args>]{<file>} takes an optional first argument where the default image width/height is \linewidth/50pt. Otherwise, you can override this with your own setting, or add other options.

Werner
  • 603,163