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 want to mention musical piece meter directly in the text, like:

This piece is written in 4/4.

Is there a way to get time signature (4/4) in form of fraction with no fraction bar? I tried musixtex package but when I do:

\begin{music}\meterfrac44\end{music}

The fraction is much bigger than the rest of the text. Of course I can try to make it smaller to fit the text but maybe there's a simpler way to do this?

share|improve this question
1  
You could do something like \newcommand*\meter[2]{\resizebox*{!}{.7\baselineskip}{\meterfrac{#1}{#2}}} and then use \meter{4}{4} in the text. BTW: \begin{music} and \end{music} isn't actually needed here. –  cgnieder Oct 19 '12 at 13:26
    
Thanks for the tip. (You're right, I checked and environment is not needed - but it was not the reason for meter fraction to be so large.) –  nuoritoveri Oct 19 '12 at 14:29
    
btw, isn't C used for 4/4 meter? (I understand that you want a general solution, I'm just making sure that I'm not missing some point.) –  yo' Oct 19 '12 at 15:29
    
@tohecz: In my experience there is free variation between the two, as they are interchangeable. –  Jon Purdy Oct 19 '12 at 17:54
    
@tohecz C might be used, but it's less popular nowadays (though I think widely understandable) and I have never encountered this in normal text, only in notation (but I don't posses much experience in this field). –  nuoritoveri Oct 19 '12 at 22:58

1 Answer 1

up vote 11 down vote accepted

I can propose two solutions:

\documentclass{article}

%%% solution 1
\usepackage{amsmath}
\newcommand{\setmetera}[2]{\ensuremath{\genfrac{}{}{0pt}{}{#1}{#2}}}

%%% solution 2
\newcommand{\setmeterb}[2]{\ensuremath{%
  \vcenter{\offinterlineskip
    \halign{\hfil##\hfil\cr
            $\scriptstyle#1$\cr
            \noalign{\vskip1pt}
            $\scriptstyle#2$\cr}
  }}%
}

\begin{document}
This is common time: \setmetera{4}{4}

This is a ternary time: \setmetera{3}{4}

\bigskip

This is common time: \setmeterb{4}{4}

This is a ternary time: \setmeterb{3}{4}
\end{document}

enter image description here

Some comments on the second solution

The definition of \setmeterb uses some low level TeX trickery. I use \ensuremath for being able to use \vcenter that will center the result with respect to the line (the "geometric center" will actually be slightly above the baseline).

In the \vcenter I set an alignment built with the primitive \halign, which avoids all the things LaTeX does with tabular in order to ensure equal spacing between rows, which is exactly what we don't want in this case where the two rows consist only of numbers; in particular the insertion of interline glue is disabled with \offinterlineskip. So the final trick is to set one centered column

\halign{\hfil#\hfil\cr ...}

and then add the two rows, separated by 1pt of white space. The # must actually be ## because we're using it in a definition.

share|improve this answer
2  
Many thanks, I used solution2 and it looks very nice (I didn't want the fraction to make lines separator larger). –  nuoritoveri Oct 19 '12 at 14:31

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.