I found a solution here on Stack Exchange to separate the numerator and denominator further from the divide line. The solution is fine if you have fractions above and below the divide line but, if you have one fraction in the numerator and no fraction in the denominator, the denominator will look quite separated from the divide line.

I figured out the solution to adjust both sides as in equation (4). However, I wish someone could explain one thing that puzzles me. You can see the values in the \raisebox tags are numbers with decimal point. In fact, if you put any number without decimal, it won't work. Why is this? The numerator or denominator or both will disappear if an integer without decimal point is entered.

Here's the LaTeX code:



  $(1) = \cfrac{\dfrac{T_1}{T_2}}{1+\dfrac{Q_1}{Q_2}}$  \\ \vspace{12pt}

  $(2) = \myfrac[12pt]{\dfrac{T_1}{T_2}}{1+\dfrac{Q_1}{Q_2}}$ \\  \vspace{12pt}

  $(3) = \myfrac[12pt]{\dfrac{T_1}{T_2}}{1+{Q_1}+{\cos{30}}}$ \\  \vspace{12pt}

  $(4) = \mfrac[12pt]{\dfrac{T_1}{T_2}}{1+{Q_1}+{\cos{30}}}$ \\  \vspace{12pt}


Enter image description here

  • What is your minimal working example? Please not put snippets code but complete starting from \documentclass.
    – Sebastiano
    Commented Feb 6, 2023 at 20:03
  • I can't submit latex code because it tells me I don't have 300 reputations. So I deleted the (\ and $) so that it will be accepted as text rather than LaTex. Commented Feb 6, 2023 at 22:01
  • 4
    300 reputation points is about creating tags (tex.stackexchange.com/help/privileges/create-tags), not publishing your LaTeX code. Please add your complete (but minimal) code between the two "```" added in your (edited) question.
    – quark67
    Commented Feb 7, 2023 at 3:57

1 Answer 1


In your code, with \raisebox{9.5#1}{$#2$}, when you use


#1 becomes 12pt, and so \raisebox{9.5#1}{$#2$} becomes \raisebox{9.512pt}{$#2$}.

9.512 pt is quite small (3,34 mm).

But with \raisebox{9#1}{$#2$} (eg when you don't use decimal point, replacing 9.5 by 9), \raisebox{9#1}{$#2$} becomes \raisebox{912pt}{$#2$}.

912pt is quite big (32 cm).

Your equation 4 is displayed on the next page.

For your problem, I suggest you to use the code provided by egreg at https://tex.stackexchange.com/a/279006/132405.

He has created the \qfrac command, with a starred version (use the starred version for fractions on denominators).

In the below code, you don't need to load the xparse package if you have recent LaTeX version (eg 2022 or newer) because it is on the LaTeX kernel now.

\usepackage{xparse} % not necessary on recent LaTeX versions

% from https://tex.stackexchange.com/a/279006/132405
  \dfrac{\IfBooleanT{#1}{\vphantom{\big|}}#2}{\mathstrut #3}%

$(1) = \dfrac{\qfrac{T_1}{T_2}}{1+\qfrac{Q_1}{Q_2}}$  \\ \vspace{12pt}
$(2) = \dfrac{\qfrac{T_1}{T_2}}{1+\qfrac*{Q_1}{Q_2}}$  \\ \vspace{12pt}
$(3) = \dfrac{\qfrac{T_1}{T_2}}{1+{Q_1}+{\cos{30}}}$ \\  \vspace{12pt}

(1) uses \qfrac for fraction on denominator: the result is not so good (the fraction in the denominator is to close to the big horizontal bar).

(2) uses \qfrac* for fraction on denominator: the result is OK.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .