Whereas
- Mathematica allows us to dump an entire notebook into a readable LaTeX file. However, the formatting of that file is not optimal.
- There are many posts on how to "beautify" a single Mathematica equation into LaTeX. But, this procedure can not be manually implemented for a notebook containing over 100 in/out.
So my question is whether there is a LaTeX style sheet which can take the .tex
file dumped by Mathematica and display it in a more appealing way.
Following is a sample of the generated code:
%% AMS-LaTeX Created by Wolfram Mathematica 9.0 : www.wolfram.com
\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}
\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}
\begin{document}
\section*{Define the load (omitting the d$\theta $) { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } }
\begin{doublespace}
\noindent\(\pmb{\text{dP}'=w R;}\)
\end{doublespace}
\section*{Primary Structure; Externally Applied load { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } }
\subsection*{\textup{ Determine horizontal reaction at B by taking moment with respect to Z (CCW +ve)}}
\begin{doublespace}
\noindent\(\pmb{\text{x1}=R \text{Cos}[\alpha ]; \text{x2}=R \text{Cos}[\theta ]; \text{y0}=R(1-\text{Sin}[\alpha ]);}\)
\end{doublespace}
\begin{doublespace}
\noindent\(\pmb{\text{SigMZ}= -\text{BX} \text{y0}+\int _{\alpha }^{\pi /2}(\text{x1}-\text{x2}) \text{dP}' d\theta }\)
\end{doublespace}
\begin{doublespace}
\noindent\(\frac{1}{2} R^2 w ((\pi -2 \alpha ) \text{Cos}[\alpha ]+2 (-1+\text{Sin}[\alpha ]))-\text{BX} R (1-\text{Sin}[\alpha ])\)
\end{doublespace}
\begin{doublespace}
\noindent\(\pmb{\text{Sol1}=\text{Solve}[\text{SigMZ}\text{==}0, \text{BX}]; \text{BX}= \text{BX}\text{/.}\text{Sol1}[[1]]}\)
\end{doublespace}
\begin{doublespace}
\noindent\(-\frac{R w (-2+\pi \text{Cos}[\alpha ]-2 \alpha \text{Cos}[\alpha ]+2 \text{Sin}[\alpha ])}{2 (-1+\text{Sin}[\alpha ])}\)
\end{doublespace}
\subsection*{\textup{ Determine vertical reaction by taking summation of forces in the y direction}}
\begin{doublespace}
\noindent\(\pmb{\text{BY}=\int _{\alpha }^{\pi /2} \text{dP}'d\theta }\)
\end{doublespace}
\begin{doublespace}
\noindent\(R w \left(\frac{\pi }{2}-\alpha \right)\)
\end{doublespace}
\begin{doublespace}
\noindent\(\pmb{\text{CX}=\text{BX}}\)
\end{doublespace}
\begin{doublespace}
\noindent\(-\frac{R w (-2+\pi \text{Cos}[\alpha ]-2 \alpha \text{Cos}[\alpha ]+2 \text{Sin}[\alpha ])}{2 (-1+\text{Sin}[\alpha ])}\)
\end{doublespace}
\end{document}
Best Answer
In terms of the equation positioning, I've added the
fleqn
option to the document class, but apart from that, the following is the only additions to the preamble to format the document contents:The intent is to
remove the use of
\pmb
in math context, since I don't know what it would be used for;remove the
doublespace
environment's use as a display math equation. Instead, remove the use of\noindent
,\(
and\)
and rather set the contents inside\[
...\]
;update
\text
to condition on its argument, thereby replacing\text{Cos}
by\cos
, as well as other possible constructions.This is for sure not perfect, and could be improved. I also assumed that the superfluous spacing inside sectional titles is due to the author adding them, and should be removed manually.
Here's a complete translation of the document: