Re: Center All Graphics

2014-10-03 Thread Chris Rackauckas
Thanks. That worked well. However, it still shows up in Lyx as left
aligned. Is there some way to grab the graphics in Lyx to do something like
for styles? For example, for styles I know I can

Style Chapter
Align Left
End

But is there a way to instead grab any graphics object?


_
Chris Rackauckas
University of California, Irvine
Department of Mathematics
www.chrisrackauckas.com

On Fri, Oct 3, 2014 at 4:03 AM, Rainer M Krug  wrote:

> Chris Rackauckas  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: Rainerkrugsde
> PGP: 0x0F52F982
>


Re: Center All Graphics

2014-10-03 Thread Rainer M Krug
Chris Rackauckas  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 
>> 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: Rainerkrugsde
PGP: 0x0F52F982


pgpxXreWZpHOH.pgp
Description: PGP signature


Re: Center All Graphics

2014-10-02 Thread Scott Kostyshak
On Thu, Oct 2, 2014 at 9:21 PM, Chris Rackauckas  
wrote:
> Hi Scott,
>   Where would I find the Koma-Script Book layout (is it named differently?)

Hi Chris,

Searching (case-insensitively) for "koma" tells me it's in the file
scrbook.layout.

> and more importantly, how would I center all graphics?

I don't know.

Best,

Scott


Re: Center All Graphics

2014-10-02 Thread Chris Rackauckas
Hi Scott,
  Where would I find the Koma-Script Book layout (is it named differently?)
and more importantly, how would I center all graphics?

_
Chris Rackauckas
University of California, Irvine
Department of Mathematics
www.chrisrackauckas.com

On Thu, Oct 2, 2014 at 3:00 PM, Scott Kostyshak  wrote:

> On Thu, Oct 2, 2014 at 4:40 PM, James Sutherland
>  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
>
> Hi James,
>
> I don't think LyX centers captions or specifically doesn't center
> graphics. From what I understand, LyX respects the class defaults,
> which in my opinion is what it should do. If you are writing an
> article for a journal whose document class has figures aligned to the
> left, they probably would not appreciate it if LyX changed that, or
> any other stylistic element. It would lead to an inconsistent journal
> edition.
>
> Best,
>
> Scott
>


Re: Center All Graphics

2014-10-02 Thread Scott Kostyshak
On Thu, Oct 2, 2014 at 4:40 PM, James Sutherland
 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

Hi James,

I don't think LyX centers captions or specifically doesn't center
graphics. From what I understand, LyX respects the class defaults,
which in my opinion is what it should do. If you are writing an
article for a journal whose document class has figures aligned to the
left, they probably would not appreciate it if LyX changed that, or
any other stylistic element. It would lead to an inconsistent journal
edition.

Best,

Scott


Re: Center All Graphics

2014-10-02 Thread Chris Rackauckas
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).

_
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 
> 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
>>
>
>


Re: Center All Graphics

2014-10-02 Thread James Sutherland
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 
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
>


Center All Graphics

2014-10-02 Thread Chris Rackauckas
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