Question: Consider the following code:

```
\documentclass{article}

\begin{document}

\noindent
Can I make \LaTeX{} reduce a fraction automatically?\\[\baselineskip]
For example, I would like the fraction
\[ \frac{278\,922}{74\,088} \]
to be reduced to
\[ \frac{6641}{1764} \]

\end{document}

```

![output](https://i.stack.imgur.com/wUiA2.jpg)

P.S. The numerator and denominator are always both natural numbers in my case.

Answer: 
If you are not bound to [`expl3`](https://www.ctan.org/pkg/expl3) (in which case you “just” need to implement the algorithm):

```
\documentclass{scrartcl}
\usepackage{xintgcd,xintfrac}

\newcommand*\reducedfrac[2]
  {\begingroup
     \edef\gcd{\xintGCD{#1}{#2}}%
     \frac{\xintNum{\xintDiv{#1}{\gcd}}}{\xintNum{\xintDiv{#2}{\gcd}}}%
   \endgroup}

\begin{document}
\[
  \frac{278922}{74088} = \reducedfrac{278922}{74088}
\]
\end{document}

```
If you are an Emacs user, just call Calc embedded (C-x \* e) while the point is on

```
\[ \frac{278922}{74088} \]

```

and the expression is transformed to

```
\[ \frac{6641}{1764} \] 

```

`C-x \* e' a second time to come back to latex-mode.

Similarly Emacs Calc can perform reduction for rational fractions, for example

```
  \[\frac{x^3 - x^2 - x - 2}{2 * x^3 - x^2 - x - 3}\]

```

"C- \* e" to enter the calc embedded mode and the command "a f"
product

```
  \[\frac{x - 2}{2 x - 3}\]

```