7

I am working on math titles, here I want to reduce the space between colon ":" default it produces before and after space. Could you please suggest me how to rectify this?

MWE:

\documentclass{book}

\usepackage{amsmath}

\begin{document}

$$
DE:AB = 18:6 \quad AB:12 = CE:15
$$

\end{document}
5

You can redeclare : to be of class \mathord. If have to restore the original behaviour, use \mathrel{:}.

\documentclass{book}

\usepackage{amsmath}

\DeclareMathSymbol{:}{\mathord}{operators}{"3A}

\begin{document}

\[ DE:AB = 18:6 \quad AB:12 = CE:15 \]

\end{document}

enter image description here

  • 1
    I’d go for a different name, e.g., \DeclareMathSymbol{\dv}{\mathord}{operators}{"3A}. I’d also consider \DeclareMathSymbol{\dv}{\mathbin}{operators}{"3A}. – GuM May 22 '18 at 7:30
  • @GuM See updated answer. I don't think you have to wrap it in a command. After all you want the spacing around colon to be consistent throughout. But it's good to know how to go back, which I have added to my answer. – Henri Menke May 22 '18 at 7:51
  • @GuM After seeing the output, I’d go for something like \newcommand\dv{\,{:}\,} – egreg May 22 '18 at 8:11
  • @egreg: I cannot make up my mind for either of the two variants (thin space or medium space). Perhaps a matter of personal taste. Maybe \newcommand*\dv{\noscript\,{:}\noscript\,} (or a robustified version thereof)? – GuM May 22 '18 at 18:32
  • Hi Henri thanks for your suggestion it has helpful and working fine. – Rajesh Kumar May 24 '18 at 6:54
11

You're using the colon as an operation symbol, which is seldom done in professional mathematics, where the colon usually denotes a relation symbol. However, the colon is commonly found in elementary mathematics.

Here is a visual comparison:

\documentclass{book}

\usepackage{amsmath}

\begin{document}

\begin{align}
& DE:AB = 18:6                     && \text{too wide} \\
& DE{:}AB = 18{:}6                 && \text{too tight} \\
& DE{\,:\,}AB = 18{\,:\,}6         && \text{maybe better} \\
& DE\mathbin{:}AB = 18\mathbin{:}6 && \text{right, IMO} 
\end{align}

\end{document}

enter image description here

When you have decided what's best for you, add one of the following definitions (\rt is for ‘ratio’, choose a different name if you wish):

\newcommand{\rt}{{:}}         % for choice 2
\newcommand{\rt}{{\,:\,}}     % for choice 3
\newcommand{\rt}{\mathbin{:}} % for choice 4

and input your proportions as

DE \rt AB = 18 \rt 6
9

Just put the colons in groups.

\documentclass{book}

\usepackage{amsmath}

\begin{document}

\[
DE{:}AB = 18{:}6 \quad AB{:}12 = CE{:}15
\]

\end{document}
2

I propose a command that seems cleaner in my opinion, and that lets you postpone the decision (in case you want to fine tune the output in the future)

\newcommand*\ratio[1]{\cleanratio#1\relax}
\def\cleanratio#1:#2\relax{#1\mathbin{:}#2}

and then use \ratio{DE:AB} = \ratio{18:6} = \ratio{3:1}. That way if you want to change the output you can (for instance #1\,\mathord{:}\,#2, or whatever). If you prefer a cleaner syntax like \ratio DE:AB = \ratio 18:6 = \ratio 3:1 we can implement it.

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.