4

I want to write geographical positions with siunitx. I think that in this notation there should be no space between number and degree symbol and also none between degree symbol and N/S or E/W notation, just like in degree celsius. So I would normally type 53,5$^\circ$N in regular LaTeX.

I try to achieve that by writing the following with siunitx:

\documentclass{report}

\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\DeclareSIUnit{\north}{N}

\begin{document}
\noindent
\SI{53,5}{\degree}\\
\SI{53,5}{\degree\north}\\
53,5$^\circ$N

\end{document}

But what I get is:

degrees

And I don't get, why siunitx is adding the space between number and degree symbol, as well as between degree symbol and N.

  • These are not units. – egreg Mar 31 '18 at 11:12
5

These are not units, stricto sensu, but siunitx is flexible enough:

\documentclass{article}
\usepackage{siunitx}

\sisetup{output-decimal-marker={,}}
\DeclareSIUnit{\north}{\degree N}
\DeclareSIUnit{\south}{\degree S}
\DeclareSIUnit{\east}{\degree E}
\DeclareSIUnit{\west}{\degree W}

\NewDocumentCommand{\xtude}{O{}mm}{%
  \SI[number-unit-product={},#1]{#2}{#3}%
}

\begin{document}

The latitude is \xtude{53,5}{\north}

The longitude is \xtude{45.3}{\east}

\end{document}

enter image description here

4

enter image description here

\documentclass{report}

\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\DeclareSIUnit{\north}{\!\degree N}

\begin{document}
\noindent
\SI{53,5}{\degree}\\
\SI{53,5}{\north}\\
53,5$^\circ$N

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.