I want to make myself a math portofolio (as a quick reference) and I have a part where I have to 'amplify' a fraction like here:

But I don't know how can I do this thing, can you help me? Thank you.

Edit: The "4)" in the upper left-hand corner means "amplify", the process of expanding both numerator and denominator by explicitly stating the value indicated as a multiplication factor. Similarly, a "(4" in the upper right-hand corner means "simplify", or merge the separate values in the numerator and denominator to a single value.

  • 1
    And what exactly should amplify mean in this context? – daleif Jul 27 '15 at 8:45
  • @daleif The thing in the left corner, because eh, this is how we romanians and a part of the world do it. – Stefan Alecu Jul 27 '15 at 8:50
  • @StefanAlecu -- please explain "amplify" in the text of the question. i wasn't familiar with the term either until i read your response to daleif's question, although i was wondering what the "4)" meant. (all the answers so far have neglected that component, and concentrated only on the coloring.) – barbara beeton Jul 27 '15 at 8:56
  • @StefanAlecu -- i've edited in an explanation of "amplify" and "simplify", so that these terms can be found in a search. (it's very hard to search on comments.) if the explanation isn't correct, please fix it. – barbara beeton Jul 27 '15 at 11:33

You should define a set of custom markup commands (see [1], [2]) for those fraction types, where you employ the xcolor package and the \prescript command from mathtools to do the needed formatting:





\[ \ampfrac{4)}{1}{2}=\coloredfrac{1\cdot 4}{2\cdot 4}=\simpfrac{(4}{4}{8} \]


Regarding your request for a more sophisticated coloring macro that is able to color the numerator and the denominator indipendantly you could define:


\coloredfrac can now be called

  • without optional arguments to get a colored fraction in the default color, which is red in this example
  • with one optional argument that sets the color for both, the numerator and the denominator
  • with two optional arguments; the first one for the color of the numerator and the second one for the color of the denominator

    \newcommand\coloredfrac{\kernel@ifnextchar[{\coloredfrac@}{\coloredfrac@[red]}}% default value: red
    %  \prescript{#1}{}{\frac{#2}{#3}}
    %  \frac{#2}{#3}^{#1}
    \[ \coloredfrac{1}{2}=\coloredfrac[green]{2}{4}=\coloredfrac[green][blue]{4}{8} \]


  • Finally, one answer that answered my question. Thank you. Does it work the other way, to have (4 in the right corner? (that is what we call simplifying) – Stefan Alecu Jul 27 '15 at 9:00
  • Sure, with something like: \newcommand{\simpfrac}[3]{\frac{#2}{#3}^{#1}} – Ruben Jul 27 '15 at 9:05

Here is a solution





enter image description here

  • It's good, but there is a problem. I want to display the thing in the left corner, the 4). That is what I don't know how to do. – Stefan Alecu Jul 27 '15 at 8:52
  • while this takes care of the fractions, it doesn't cover the "4)" in the upper left corner. (see comments on the question. i didn't know what "amplify" meant either, until i read those.) – barbara beeton Jul 27 '15 at 8:53
  • I guess it was also my fault that I didn't specify. – Stefan Alecu Jul 27 '15 at 8:57
  • @StefanAlecu answer edited – touhami Jul 27 '15 at 8:58

Do you perhaps mean something like "highlight" by "amplify"?

Anyway, I think

\newcommand{\colorfrac}[3][red]{\frac{{\color{#1} #2}}{{\color{#1} #3}}} 

would suit your purpose.


would give a red '1/2' and


a green one (needs the color package).



As an answer to your comment: Of course you could, manually using \frac{{\color{color1} 1}}{{\color{color2} 2}} or by a command similar to the one defined above.

Okay, now I understood what you want. One solution (\prescribe in the other one is probably better, but still):

  • Nope, but at least now I know how to color fractions. Can you color individual parts of a fractions (the top only)? – Stefan Alecu Jul 27 '15 at 8:52
  • edited my answer – Bort Jul 27 '15 at 9:02
  • I think for the individual coloring it is best to have a syntax with optional arguments, like \colorfrac[<color-num>][<color-den>]{<num>}{<den>} -- and \colorfrac[<color-both>]{<num>}{<den>} should be available too (see my answer). – Ruben Jul 27 '15 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.