How to Represent Complex Fractions in LaTeX?

Click For Summary

Discussion Overview

The discussion revolves around representing complex fractions in LaTeX, exploring various methods to achieve desired formatting, particularly focusing on the length of division lines and spacing in mathematical expressions. Participants share techniques and examples related to LaTeX syntax, addressing both theoretical and practical aspects of typesetting.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Dan proposes two methods for representing complex fractions in LaTeX and inquires about creating a longer middle division line.
  • One participant suggests adding LaTeX spaces to the numerator or denominator to extend the middle line.
  • Another participant notes that explicit "~" characters may be necessary to force spaces in LaTeX, while regular spaces sometimes do not render as expected.
  • Discussion includes the use of various spacing commands in LaTeX, such as \!, \, \:, \;, \quad, and \qquad, with explanations of their effects on spacing.
  • Examples are provided to illustrate the use of spaces in integrals and other mathematical expressions, highlighting differences between regular spaces and non-breaking spaces.
  • One participant mentions the physics package in LaTeX, which can help manage spacing automatically for integrals.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness of various spacing methods in LaTeX, indicating that there is no consensus on the best approach to achieve desired formatting in all cases.

Contextual Notes

Some limitations are noted regarding the rendering of spaces in math mode, where regular spaces are often treated as separators rather than actual spaces. The discussion also touches on the context-specific nature of spacing commands in LaTeX.

topsquark
Science Advisor
Homework Helper
Insights Author
MHB
Messages
2,020
Reaction score
843
TL;DR
Exploring different ways to represent a complex fraction using LaTeX
I know of two reasonable ways to represent a complex fraction:
\dfrac{ \left ( \dfrac{a}{b} \right ) }{ \left ( \dfrac{c}{d} \right ) }
##\dfrac{ \left ( \dfrac{a}{b} \right ) }{ \left ( \dfrac{c}{d} \right ) }##

and
\dfrac{ ^a / _b }{ ^c / _d }
##\dfrac{ ^a / _b }{ ^c / _d }##

What I am wondering is if there is a way to write
##\dfrac{ \dfrac{a}{b} }{ \dfrac{c}{d} }##
by making a longer middle division line?

Thanks!

-Dan
 
Physics news on Phys.org
Hey Dan,

One way to make the middle line longer, is to add latex spaces to numerator or denominator.
For instance:
\dfrac{\;\dfrac ab\;}{\dfrac cd}
##\dfrac{\;\dfrac ab\;}{\dfrac cd}##
 
  • Informative
  • Like
Likes   Reactions: topsquark and berkeman
I like Serena said:
add latex spaces to numerator or denominator
Sometimes I have to add explicit "~" characters to force spaces in LaTeX, but other times just " " spaces seem to work. I haven't figured out why yet...
 
  • Like
Likes   Reactions: topsquark
berkeman said:
Sometimes I have to add explicit "~" characters to force spaces in LaTeX, but other times just " " spaces seem to work. I haven't figured out why yet...
Can you give some examples?
 
berkeman said:
Sometimes I have to add explicit "~" characters to force spaces in LaTeX, but other times just " " spaces seem to work. I haven't figured out why yet...
Regular spaces are generally used as separator. For instance in \dfrac ab the space is not an actual space, but instead it's a separator. That separator only "becomes" a space, if that is needed to separate both sides. In that case multiple spaces are collapsed to a single space.
If we actually "want" a space where that is not already natural, we have to use one of the latex spaces like:
\! \, \: \; \quad \qquad, which are increasingly wide spaces. The first one is a negative space. The "~" is special in that it creates a non-breaking space, so that it won't "wrap".
 
  • Like
  • Informative
Likes   Reactions: Orodruin, berkeman and topsquark
Orodruin said:
Can you give some examples?
Just a quick example:
$$v(t) = L \frac{di(t)}{dt}$$
$$v(t) = L~\frac{di(t)}{dt}$$
from:
1662414182567.png
 
The classical example is an integral: $$\int f(x,y) dx dy$$
Often \, is inserted (despite already having spaces) before the infinitesimals to get a more natural formula:$$\int f(x,y)\,dx\,dy$$
A "~" also works of course.
 
  • Like
Likes   Reactions: pbuk and topsquark
berkeman said:
Just a quick example:
$$v(t) = L \frac{di(t)}{dt}$$
$$v(t) = L~\frac{di(t)}{dt}$$
from:
View attachment 313827
I meant examples of where you would expect a space but there was none.

I like Serena said:
A "~" also works of course.
Compare the following:
$$
\int f(x,y)~dx~dy \qquad \int f(x,y)\,dx\,dy
$$
The non-breaking space ~ is a regular sized space (it is equivalent in size to the regular \ ) as compared to \, which is 3 mu. The latter is typically what you want. The non-breaking space ~ should be used when you have a space where you do not wish to create a (line or page) break. In an equation it is essentially equivalent to the regular space "\ " (which has its own uses in text as well, such as not creating a too large space after an abbreviation, i.e., LaTeX will interpret "cf. last chapter" as there being an end of sentence after cf. whereas "cf.\ last chapter" will not).
 
  • Like
Likes   Reactions: I like Serena and topsquark
Orodruin said:
I meant examples of where you would expect a space but there was none.
In the first LaTeX line, I put a " " space after the L, but it did not render. It took the explicit "~"space after the L to get it to render.
 
  • #10
berkeman said:
In the first LaTeX line, I put a " " space after the L, but it did not render. It took the explicit "~"space after the L to get it to render.
Of course it didn’t, spaces are mostly irrelevant to math mode (for good reason).
 
  • #11
For integrals, using the physics package might be helpful to some extent. One may use \dd{} from that package, which manages the spacing automatically, and also makes the d upright.
$$\require{physics}
\int f(x,y) \dd{x} \dd{y}$$
 
  • Like
Likes   Reactions: topsquark

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K