I am doing a coursework in mechanics and would like to write both the theory and calculations in LaTeX. However, as design is iterative process, I would like to escape the tedious cycle of:
- Select starting values for diameters, lengths etc.
- Go through numerous steps, calculating derived values.
- The last step is stress-strength analysis and if that fails, go to step one.
Here is what I have got so far.
\documentclass{article}
\usepackage[nomessages]{fp} % http://ctan.org/pkg/fp
\usepackage[table]{xcolor} % For coloured rows within tables.
\begin{document}
\FPset{vAlpha}{20}
\rowcolors{1}{white}{lightgray}
\begin{tabular}{l | c | c | c | c | c | c | c | c}
Gear & $\alpha$ & $h_a$, [mm] & c, [mm] & $h_f$, [mm] & $\rho$, [mm] & $h_w$, [mm] & h, [mm] & s, [mm] \\
G11 & \vAlpha & \FPprint{vAlpha * 0.25} & & & & & & \\
\end{tabular}
\end{document}
As is evident, I am attempting to make calculations inside the table and directly display the result. It is not working (the third column is outputting nothing).
I know that \FPeval
or \FPmul
would work in this case, but I find them too cumbersome for the following reason. They both require me to assign the result to a variable, which I can later \FPprint
. This is not very useful to me, as I would then need to compute a large number of variables and then invoke \FPprint
inside the table.
I am not going to be using the computed result for anything else than displaying it in the table. All entries are a variable (different variables) multiplied by a constant. What is the best solution?
pgfplotstable
and it seems a rather comprehensive package. You can expect a flurry of questions about it in a couple of weeks, when I find myself writing my graduation paper. Any reason why you prefer C to a higher-level language, e.g. python?