0

I know, it sounds strange, but I need to have a fraction in italics. I have plenty of tables in my document where in one column everything is always in italics. And there I have one specific table with some simple fractions. I don't need and don't want them in math-mode. I tried following to have it look as text-mode:

\begin{longtable}[r]{p{0.46\linewidth}p{0.46\linewidth}}

$\frac{\text{1}}{\text{2}}$ & một \textbf{phần} hai \\ 
\\
$\frac{\text{3}}{\text{4}}$ & ba \textbf{phần} tư \\
\\
$\frac{\text{6}}{\text{8}}$ & sáu \textbf{phần} tám \\

\end{longtable}

But when it finally looks as all other text, I can't make it italic. I tried this:

\begin{longtable}[r]{p{0.46\linewidth}p{0.46\linewidth}}

$\frac{\text{\textit{1}}}{\text{\textit{2}}}$ & một \textbf{phần} hai \\ 
\\
$\frac{\text{\textit{3}}}{\text{\textit{4}}}$ & ba \textbf{phần} tư \\
\\
$\frac{\text{\textit{6}}}{\text{\textit{8}}}$ & sáu \textbf{phần} tám \\

\end{longtable}

but it doesn't look good... I mean: It is not the whole fraction that is in italics - it's only the numbers that went into italics.

italic numbers in fractions

Does anyone have an idea if there's a better way to have it done?

Dominik
  • 483
  • 1
    "Looking good" is subjective and depends also on the font (in your picture it's a sans-serif one). But instead of your \text{\textit{1}} construction you could use simply \mathit. Or even define \newcommand*{\itfrac}[2]{\frac{\mathit{#1}}{\mathit{#2}}}. – campa Aug 26 '15 at 14:14
  • Sorry, I overlooked the title "No math-mode preferred". – campa Aug 26 '15 at 14:18
  • You could try something like $\frac{\it 1}{\it 2}$ or even ${\it \frac{1}{2}}$. It's definitely shorter. – RHertel Aug 26 '15 at 14:19
  • What I mean saying "not looking good" is: It is not the whole fraction that is in italics - it's only the numbers that went into italics. – Dominik Aug 26 '15 at 14:25
  • @Dominik, you said: It is not the whole fraction that is in italics - it's only the numbers that went into italics. So I think that you want also the bar slanted. – Sigur Aug 26 '15 at 14:30
  • @TorbjørnT Thank you for your comment. I didn't even know \it was an "obsolete command". I've been using LaTeX for many years. It's hard to change habits, but I'm glad to learn about new developments. – RHertel Aug 26 '15 at 14:32
  • @Sigur In some way: yes. If the whole fraction was slanted, everything would be aligned to an invisible slanted line on the left. But as for now every part of the fraction is aligned vertically. Do you get what I mean? – Dominik Aug 26 '15 at 14:56

1 Answers1

6

Simple text fraction

A simple way for simple fractions is the text form a/b:

\documentclass{article}
\usepackage[utf8]{vietnam}

\usepackage{array}
\usepackage{longtable}

\begin{document}
\begin{longtable}[r]{>{\itshape}p{0.46\linewidth}p{0.46\linewidth}}
  1/2 & một \textbf{phần} hai \\
  3/4 & ba \textbf{phần} tư \\
  6/8 & sáu \textbf{phần} tám \\
\end{longtable}
\end{document}

Result

Package nicefrac

\documentclass{article}
\usepackage[utf8]{vietnam}

\usepackage{array}
\usepackage{longtable}

\usepackage{nicefrac}

\begin{document}
\begin{longtable}[r]{>{\itshape}p{0.46\linewidth}p{0.46\linewidth}}
  \nicefrac{1}{2} & một \textbf{phần} hai \\
  \nicefrac{3}{4} & ba \textbf{phần} tư \\
  \nicefrac{6}{8} & sáu \textbf{phần} tám \\
\end{longtable}
\end{document}

Result nicefrac

Package xfrac

\documentclass{article}
\usepackage[utf8]{vietnam}

\usepackage{array}
\usepackage{longtable}

\usepackage{xfrac}

\begin{document}
\begin{longtable}[r]{>{\itshape}p{0.46\linewidth}p{0.46\linewidth}}
  \sfrac{1}{2} & một \textbf{phần} hai \\
  \sfrac{3}{4} & ba \textbf{phần} tư \\
  \sfrac{6}{8} & sáu \textbf{phần} tám \\
\end{longtable}
\end{document}

Result

Horizontal fraction line with shifted numerator

\documentclass{article}
\usepackage[utf8]{vietnam}

\usepackage{array}
\usepackage{longtable}

\usepackage{amstext}
\newcommand*{\itfrac}[2]{%
  \ensuremath{%
    \frac{\,\text{\itshape #1}}{\mkern-\thinmuskip\text{\itshape #2}}%
  }%
}

\begin{document}
\begin{longtable}[r]{>{\itshape}p{0.46\linewidth}p{0.46\linewidth}}
  \itfrac{1}{2} & một \textbf{phần} hai \\
  \itfrac{3}{4} & ba \textbf{phần} tư \\
  \itfrac{6}{8} & sáu \textbf{phần} tám \\
\end{longtable}
\end{document}

Result with horizontal fraction line and shifted numerator

If math fonts should be used, then \text{\itshape ...} can be replaced by \mathit.

Heiko Oberdiek
  • 271,626
  • OK, that's true. But it avoids the typical writing of one digit above the other... – Dominik Aug 26 '15 at 14:57
  • @Dominik The slash is also a typical form for a fraction especially for text. I have now added a variant with horizontal line, but shifted numerator. The variants with nicefrac and xfrac act as "nice" compromise between the two extremes. – Heiko Oberdiek Aug 26 '15 at 15:14