[OS X TeX] colorbox
Ross Moore
ross at ics.mq.edu.au
Tue Feb 8 00:54:36 CET 2005
Hi Alain, and Chris,
On 08/02/2005, at 10:13 AM, Alain Schremmer wrote:
> In the following, I am unable to let the fraction on the top line have
> the same size as the one on the second line which is made pleasantly
> smaller by the colorbox.
> While it is of course of infinitesimal importance, I would be happy if
> someone could show me what I am missing.
Your first \frac is in display-mode, due to the {equation*} and/or
{split} environments.
The second \frac is within $...$ inside a box, so is inline-mode
mathematics, the
same as if it were in ordinary paragraphs.
Since you are using {amsmath} anyway, take advantage of the \dfrac
command,
to use \displaystyle layout within inline mathematics.
Similarly use \tfrac to use inline (\textstyle) layout within displays.
This is very useful for small numerical fractions, such as \tfrac{1}{2}
etc.
> Regards
> --schremmer
>
> \documentclass[11pt]{book}
> \usepackage{amsmath}
> \usepackage{color}
> \DeclareMathAlphabet{\denom}{OT1}{cmss}{sbc}{n}
> \begin{document}
> \begin{equation*}
> \begin{split}
> 8\;\denom{Dimes}
> &= 3\;\denom{Apples}\times1\;\frac{\denom{Dimes}}{\denom{Apple}}
> + 4\;\denom{Dimes}
> \\ &=
> \colorbox{yellow}{$3\;\denom{Apples}$}\times\colorbox{yellow}{$2\;
> \frac{\denom{Dimes}}{\denom{Apple}}$} +1\;\denom{Dimes}
> \end{split}
> \end{equation*}
> \end{document}
>
> Christopher Allen wrote:
>
>>> I had done quite a bit of experimentation and, indeed, "couldn't
>>> accept" that a command would take things "out of math mode".
Whenever you put things inside a box, this happens
--- unless someone has gone to a lot of trouble to
write coding that remembers what the mode was outside
of the box, and recreate it on the inside.
The use of a box is so that the contents can be typeset
in a self-contained fashion.
There are many times when you want to use non-math layout
within a part of a mathematical expression.
It makes a lot more sense to have the default behaviour this
way than to automatically inherit from the outer environment.
>>
>>
>> There are a few commands that do this, the most obvious one is
>> \text{}, specifically used to do so.
>>
>> There are also commands that will take you into math mode in a
>> similar fashion. For example, if you use \boxed{} in the middle of a
>> paragraph, whatever is put into the box is typeset in math mode.
There's also a command \ensuremath{....}
that's useful in places where you don't know whether you'll
be using it within math or not.
Hope this helps,
Ross
>>
>> Chris
>>
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 +2 9850 8955
Sydney, Australia fax: +61 +2 9850 8114
------------------------------------------------------------------------
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list