my Latex and Tex4ht cheat sheet
my Latex cheat sheet - 12000.org
my Latex cheat sheet - 12000.org
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
\documentclass{article}<br />
\usepackage{luacode}<br />
\usepackage{amsmath}<br />
%------------------------<br />
\begin{luacode}<br />
function simplify(a,b)<br />
local function gcd(a,b)<br />
if b ~= 0 then<br />
return gcd(b, a % b)<br />
else<br />
return math.abs(a)<br />
end<br />
end<br />
t = gcd(a, b)<br />
tex.print("\\frac{"..a/t.."}{"..b/t.."}")<br />
end<br />
\end{luacode}<br />
\newcomm<strong>and</strong>\simplify[2]{\directlua{simplify(#1,#2) }}%<br />
%-------------------<br />
\begin{document}<br />
\noindent Can I make \LaTeX{} reduce a fraction automatically?\\[\baselineskip]<br />
For example, I would like the fraction<br />
\begin{equation*}<br />
\frac{278\,922}{74\,088}<br />
\end{equation*}<br />
to be reduced to<br />
\begin{equation*}<br />
\simplify{278922}{74088}<br />
\end{equation*}<br />
\end{document}<br />
The output of the above is<br />
Can I make LATEX reduce a fraction automatically?<br />
For example, I would like the fraction<br />
to be reduced to<br />
278 922<br />
74 088<br />
6641<br />
1764<br />
2.43.3 read CVS field to <strong>Latex</strong> table<br />
This uses lua function to read the specific field in the CVS file. For example, given this CVS file in the directory<br />
42