Chris Rackauckas <m...@chrisrackauckas.com> writes:

> Centering the graphics in floats automatically is easy: Just add
> \usepackage{floatrow}
> to the preamble. I just made a module that does this and it's a quick fix
> to everything. However, for this lab notebook I am making, I want to
> quickly add graphics and not worry about having to center them or put them
> into floats (and all of the formatting jazz that goes with it).

I had a similar question, and I =rmember that I redifined the
\includegraphics - but I don't remember any details anymore. 

See e.g. the thread  "Re: Search and replace within figure settings?" in
this group for an example on how to include always a shadowbox - this
could be easily changed to center the included graphics.

Here the relevant extract:

--8<---------------cut here---------------start------------->8---
%%%%%%%%
% from
% 
http://tex.stackexchange.com/questions/70547/how-can-i-renew-includegraphics-to-always-use-shadowbox
\usepackage{graphicx,fancybox,letltxmacro}
% save the meaning of \includegraphics
\LetLtxMacro\latexincludegraphics\includegraphics
% pass the image to \shadowbox
\renewcommand{\includegraphics}[2][]{%
    \shadowbox{\latexincludegraphics[#1]{#2}}}
%%%%%%%%

In addition, I used the following in the preamble to make the graphics always 
centered:

\renewenvironment{figure}[1][]{
 \@float{figure}
 \centering}
 {\end@float}
--8<---------------cut here---------------end--------------->8---


Cheers,

Rainer

>
> _________________________________________________
> Chris Rackauckas
> University of California, Irvine
> Department of Mathematics
> www.chrisrackauckas.com
>
> On Thu, Oct 2, 2014 at 1:40 PM, James Sutherland <
> james.sutherl...@chemeng.utah.edu> wrote:
>
>> Better yet, why doesn't LyX center graphics (at least in floats) by
>> default?  It centers captions by default, so why not graphics? This
>> inconsistency has long annoyed me...
>>
>> James
>> 
>>
>>
>> On Thu, Oct 2, 2014 at 2:19 PM, Chris Rackauckas <m...@chrisrackauckas.com>
>> wrote:
>>
>>> Hello,
>>>   I am trying to create a modification that will center all graphics
>>> automatically. How would I go about doing this? I tried
>>> adding \usepackage{floatrow} to the LaTeX preamble but this only centers
>>> graphics put into floats. Any ideas?
>>> _________________________________________________
>>> Chris Rackauckas
>>> University of California, Irvine
>>> Department of Mathematics
>>> www.chrisrackauckas.com
>>>
>>
>>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Attachment: pgpxXreWZpHOH.pgp
Description: PGP signature

Reply via email to