Move the decision how to typeset unit to TeX-style file

This way, the user can adopt those once and for all for all
her dives. This includes the space between number and unit symbol.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-08-08 15:59:38 +02:00 committed by Dirk Hohndel
parent 0c426c37b2
commit d5d97870c3
2 changed files with 27 additions and 30 deletions

View file

@ -270,29 +270,12 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
put_format(&buf, "%% respectively. If you wish to display the original values, you may edit this\n");
put_format(&buf, "%% list and all calls to those units will be updated in your document.\n");
tmp = get_depth_units(1, NULL, &unit);
put_format(&buf, "\\def\\depthunit{%s}\n", unit);
tmp = get_weight_units(1, NULL, &unit);
put_format(&buf, "\\def\\weightunit{%s}\n", unit);
tmp = get_pressure_units(1, &unit);
put_format(&buf, "\\def\\pressureunit{%s}\n", unit);
tmp = get_temp_units(1, &unit);
put_format(&buf, "\\def\\temperatureunit{%s}\n", unit);
tmp = get_volume_units(1, NULL, &unit);
if (strcmp(unit, "") == 0)
{
put_format(&buf, "\\def\\volumeunit{L}\n");
}
else if (strcmp(unit, "cuft") == 0)
{
put_format(&buf, "\\def\\volumeunit{ft$^{3}$}\n");
}
else
{
put_format(&buf, "\\def\\volumeunit{%s}\n", unit);
}
tmp = get_vertical_speed_units(1, NULL, &unit);
put_format(&buf, "\\def\\verticalspeedunit{%s}\n", unit);
put_format(&buf, "\\def\\depthunit{\\unit%s}", units->length == units::METERS ? "meter" : "ft");
put_format(&buf, "\\def\\weightunit{\\unit%s}", units->weight == units::KG ? "kg" : "lb");
put_format(&buf, "\\def\\pressureunit{\\unit%s}", units->pressure == units::BAR ? "bar" : "psi");
put_format(&buf, "\\def\\temperatureunit{\\unit%s}", units->temperature == units::CELSIUS ? "celsius" : "fahrenheit");
put_format(&buf, "\\def\\volumeunit{\\unit%s}", units->volume == units::LITER ? "liter" : "cuft");
put_format(&buf, "\\def\\verticalspeedunit{\\unit%s}", units->length == units::METERS ? "meterpermin" : "ftpermin");
put_format(&buf, "\n%%%%%%%%%% Begin Dive Data: %%%%%%%%%%\n");

View file

@ -9,6 +9,20 @@
\parindent=1cm
%\offinterlineskip
\long\def\page{
%% Unit symbols, add spaces in front if you prefer
\def\unitmeter{m}
\def\unitft{ft}
\def\unitkg{kg}
\def\unitlb{lb}
\def\unitbar{bar}
\def\unitpsi{psi}
\def\unitcentigrate{${}^\circ$C}
\def\unitfahrenheit{${}^\circ$F}
\def\unitliter{$\ell$}
\def\unitcuft{cuft}
\def\unitmeterpermin{m/min}
\def\unitftpermin{ft/min}
%
$$\vbox{\hrule % upper cutting line
\vskip 2.0cm % upper whitespace
\vrule % left cutting line