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 need to reference several times (eg. 2:30 - two minutes and thirty seconds) from a song for an assignment I am working on.

I have thought of using $2$:$30$ because I thought using 2:30 would be incorrect.

Is my method of typesetting song duration correct or is there some other method that is?

share|improve this question
4  
Adding the $ will set it in math font, rather than text font. In many cases, they will be the same font. For music, where math and equations seems distant from the application, I would think 2:30 would suffice (without the dollars). –  Steven B. Segletes Jun 25 at 19:24
2  
@StevenB.Segletes, I see. So any set of numbers that are not related to mathematics not need be set in the mathematics font? –  user133987 Jun 25 at 19:28
2  
That's correct. When in math mode, other things will apply, like italic variables and extra space inserted around math operators, as in a+b versus $a+b$. But in your case, none of that is relevant. –  Steven B. Segletes Jun 25 at 19:30
    
Thank you, this helps a lot with other LaTeX projects! –  user133987 Jun 25 at 19:32

1 Answer 1

up vote 6 down vote accepted

2:30 will be incorrect, because of a space added between : and 30. I suggest a macro with a syntax close to what one writes: it takes 2:30 or even 2: 30 or 2 : 30 as an argument and will print something like Duration 2:30 and a correct spacing (a thin space on both sides of the colon). It requires the etoolbox and xparse packages.

In addition, if the time is, say 3:00, you just have to type 3, the 00 will be added. If the length is less than 1 minute, you just type :45, say.

I didn't implement the case of ragas, for which the length can be more than 1 h, but it would be easy to do :)

Here is an example with and without the macro:

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{cabin}
\usepackage{etoolbox, xparse}

\def\lgthname{Duration}
\DeclareDocumentCommand \lgth%
{ >{\SplitArgument {1}{:}} m }
{\lgthaux#1}
\NewDocumentCommand{\lgthaux}{mm}
{\lgthname\quad\ifblank{#1}{0}{#1}\,:\,\IfNoValueTF{#2}{00}{#2}}

    \begin{document}

\sffamily
\lgth{2: 30} \qquad \lgth{: 45}\qquad\lgth{3}\\

Duration\quad2 : 30\\

Duration\quad2:30\\

\end{document} 

enter image description here

share|improve this answer

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.