Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know if the siunitx package offers the possibility of adding an adjective after the unit, to get a hyphenated compound adjective.

For instance, when typesetting "a 10 km-long road", I would like to pass the adjective as an optional argument to \SI{1}{\kilo\meter}, as in \SI[[adj=long]{1}{\kilo\meter}, instead of having to type \SI{1}{\kilo\meter}-long.

Please understand that there is nothing wrong with the \SI{1}{\kilo\meter}-long syntax. It just "feels" wrong to hyphenate a command with a word. Also, I think this would make corrections a bit more straightforward.

If this functionality is not offered, is it something the author of the package has thought of or is planning to implement?

share|improve this question
1  
What is wrong with \SI{1}{\kilo\meter}-long? –  Qrrbrbirlbel Oct 1 '12 at 14:58
    
Almost certainly not the best way to write this: I would go for words in the example given. –  Joseph Wright Oct 1 '12 at 15:05
    
Such a construction is typical in English, but it's completely extraneous to other languages such as Italian and French. –  egreg Oct 1 '12 at 15:05
    
@Qrrbrbirlbel The only thing wrong with \SI{1}{\kilo\meter}-long is that you're hyphenating the command with a word. It just feels like bad practice. I edited my question accordingly. –  Kpantzas Oct 1 '12 at 15:06
1  
ISO 80000-1 sec. 7.2.1 says "any attachment to a unit symbol as a means of giving information about the special nature of the quantity or context of measurement under consideration is not permitted". So, I could be wrong, but I think you shoudn't attach anything to a unit symbol by means of a hyphen. There is an example here (physics.nist.gov/cuu/pdf/sp811.pdf) where the term "long" is not attached to the unit symbol. –  Luigi Oct 1 '12 at 16:29
show 2 more comments

1 Answer

You could define your own macro:

\newcommand*\SIadj[4][]{\SI[#1]{#3}{#4}-#2}

and use it as

\SIadj{long}{1}{\kilo\metre}

If you want to prevent hypenations use

\newcommand*\SIadj[4][]{\mbox{\SI[#1]{#3}{#4}-#2}}

or

\newcommand*\SIadj[4][]{\SI[#1]{#3}{#4}\hbox{-}#2}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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