More details for TeX export

Include the gasname, get rid of more spaces in front of units,
update the template to use new gas fields.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-08-09 12:44:38 +02:00 committed by Dirk Hohndel
parent d5d97870c3
commit 514c298600
2 changed files with 24 additions and 5 deletions

View file

@ -357,15 +357,17 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
if (is_cylinder_used(dive, i) || (prefs.display_unused_tanks && dive->cylinder[i].type.description)){ if (is_cylinder_used(dive, i) || (prefs.display_unused_tanks && dive->cylinder[i].type.description)){
put_format(&buf, "\\def\\cyl%cdescription{%s}\n", 'a' + i, dive->cylinder[i].type.description); put_format(&buf, "\\def\\cyl%cdescription{%s}\n", 'a' + i, dive->cylinder[i].type.description);
put_format(&buf, "\\def\\cyl%cgasname{%s}\n", 'a' + i, gasname(&dive->cylinder[i].gasmix));
put_format(&buf, "\\def\\cyl%cmixO2{%.1f\\%%}\n", 'a' + i, get_o2(&dive->cylinder[i].gasmix)/10.0); put_format(&buf, "\\def\\cyl%cmixO2{%.1f\\%%}\n", 'a' + i, get_o2(&dive->cylinder[i].gasmix)/10.0);
put_format(&buf, "\\def\\cyl%cmixHe{%.1f\\%%}\n", 'a' + i, get_he(&dive->cylinder[i].gasmix)/10.0); put_format(&buf, "\\def\\cyl%cmixHe{%.1f\\%%}\n", 'a' + i, get_he(&dive->cylinder[i].gasmix)/10.0);
put_format(&buf, "\\def\\cyl%cmixN2{%.1f\\%%}\n", 'a' + i, (100.0 - (get_o2(&dive->cylinder[i].gasmix)/10.0) - (get_he(&dive->cylinder[i].gasmix)/10.0))); put_format(&buf, "\\def\\cyl%cmixN2{%.1f\\%%}\n", 'a' + i, (100.0 - (get_o2(&dive->cylinder[i].gasmix)/10.0) - (get_he(&dive->cylinder[i].gasmix)/10.0)));
delta_p.mbar += dive->cylinder[i].start.mbar - dive->cylinder[i].end.mbar; delta_p.mbar += dive->cylinder[i].start.mbar - dive->cylinder[i].end.mbar;
put_format(&buf, "\\def\\cyl%cstartpress{%.1f \\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].start.mbar, &unit)/1.0); put_format(&buf, "\\def\\cyl%cstartpress{%.1f\\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].start.mbar, &unit)/1.0);
put_format(&buf, "\\def\\cyl%cendpress{%.1f \\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].end.mbar, &unit)/1.0); put_format(&buf, "\\def\\cyl%cendpress{%.1f\\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].end.mbar, &unit)/1.0);
qty_cyl += 1; qty_cyl += 1;
} else { } else {
put_format(&buf, "\\def\\cyl%cdescription{}\n", 'a' + i); put_format(&buf, "\\def\\cyl%cdescription{}\n", 'a' + i);
put_format(&buf, "\\def\\cyl%cgasname{}\n", 'a' + i);
put_format(&buf, "\\def\\cyl%cmixO2{}\n", 'a' + i); put_format(&buf, "\\def\\cyl%cmixO2{}\n", 'a' + i);
put_format(&buf, "\\def\\cyl%cmixHe{}\n", 'a' + i); put_format(&buf, "\\def\\cyl%cmixHe{}\n", 'a' + i);
put_format(&buf, "\\def\\cyl%cmixN2{}\n", 'a' + i); put_format(&buf, "\\def\\cyl%cmixN2{}\n", 'a' + i);

View file

@ -4,6 +4,7 @@
\font\klein=cmr9 \font\klein=cmr9
\font\winzig=cmr5 \font\winzig=cmr5
\def\slinie{\hrulefill\hskip 3em} \def\slinie{\hrulefill\hskip 3em}
\def\leer{}
\overfullrule=0pt \overfullrule=0pt
\def\p{\hskip 0.5cm} % typical horizontal room \def\p{\hskip 0.5cm} % typical horizontal room
\parindent=1cm \parindent=1cm
@ -43,10 +44,26 @@ $\vbox to 15cm{ % height of box
\bigskip \bigskip
\hbox to 10cm{\hss\breit\strut \time \p@\p\hbox to 1.5cm{\hss\depth}\hss} \hbox to 10cm{\hss\breit\strut \time \p@\p\hbox to 1.5cm{\hss\depth}\hss}
\bigskip \bigskip
\hbox to 10cm{\klein\p $\Delta p$:\hbox to 1cm{\hrulefill\gasuse}\hss \hbox to 10cm{\klein\p $\Delta p$: \hbox to 1cm{\hrulefill\gasuse}\hss
SAC:\hbox to 1.5cm{\hrulefill\sac}\hss SAC: \hbox to 1.5cm{\hrulefill\sac}\hss
Type:\hbox to 1.2cm{\hrulefill\type}\hss Viz.: Type: \hbox to 1.2cm{\hrulefill\type}\hss Viz.:
\hbox to 0.8cm{\hrulefill\viz}\p} \hbox to 0.8cm{\hrulefill\viz}\p}
\ifx\cylagasname\leer\else
\hbox to 10cm{\p\klein
\cyladescription\ \cylagasname: \cylastartpress\ -- \cylaendpress
\hss}
\fi
\ifx\cylbgasname\leer\else
\hbox to 10cm{\p\klein
\cylbdescription\ \cylbgasname: \cylbstartpress\ -- \cylbendpress
\hss}
\fi
\ifx\cylcgasname\leer\else
\hbox to 10cm{\p\klein
\cylcdescription\ \cylcgasname: \cylcstartpress\ -- \cylcendpress
\hss}
\fi
\bigskip \bigskip
\hbox{\p\hsize = 9cm \hbox{\p\hsize = 9cm
\vbox{\noindent \vbox{\noindent