# How to make inline formulas look more compact?

I have something published by IEEE. I noticed that with the PDF generated by myself (top picture), some inline vectors look not as compact as in the PDF version produced by IEEE (bottom picture). The comparison is as follows. My question is, in general (it could be IEEEtran class, book class, or something else), how to make those inline math look more compact? What package or options should I use to achieve a similar result?

This is the code for producing those lines:

columns of $\boldsymbol{\mathcal{A}}$ identical and its rank is reduced to 2,
with the null space of $\left\{ \left[\begin{array}{ccc} -1/\sqrt{2} & 0 & 1/\sqrt{2}\end{array}\right]^{\text{T}}\right\}$. The other part of the
condition shows that for an $\boldsymbol{\mathbf{N}}=\left[\begin{array}{ccc} N_{1} & N_{2} & N_{3}\end{array}\right]^{\text{T}}$ in
$\boldsymbol{\mathcal{A}}$ null space to be a reasonable solution, $N_{1}=N_{3}$
must be satisfied.

• Obviously the \left and \right are adding a lot of space for one thing Sep 5 '18 at 16:48

I don't think the braces should go in the first instance. Anyway, inline math with \left and \right will usually disrupt the interline spacing. I suggest using simply [...].

I also suggest a few improvements:

1. instead of the clumsy \boldsymbol{\mathcal{A}} you can define a new command, \bcal;
2. using matrix instead of array will remove the sidebearings from the array;
3. \text{T} for the transpose would give bad results in case the text is in a theorem statement, better using \mathrm (inside a semantic command).

Note also that \boldsymbol{\mathbf{N}} does nothing different from \mathbf{N}.

The vinculum of the square root would clash with the bracket, so I recommend \, for inserting a thin space.

I suggest two realizations for \rowvector: one with the default intercolumn space, one with half of it.

\documentclass{article}
\usepackage{amsmath,bm}

\newcommand{\bcal}[1]{\bm{\mathcal{#1}}}
\newcommand{\transpose}{^{\mathrm{T}}}

\newcommand{\rowvector}[1]{[\begin{matrix}#1\end{matrix}]}

\begin{document}

\noindent % just for this example
columns of $\bcal{A}$ identical and its rank is reduced to~$2$, with the null
space of $\rowvector{-1/\sqrt{2} & 0 & 1/\sqrt{2}\,}\transpose$.
The other part of the condition shows that for an
$\mathbf{N}=\rowvector{N_{1} & N_{2} & N_{3}}\transpose$ in
$\bcal{A}$ null space to be a reasonable solution, $N_{1}=N_{3}$
must be satisfied.

\bigskip

% for the second example
\renewcommand{\rowvector}[1]{%
[\begingroup
\setlength\arraycolsep{0.5\arraycolsep}%
\begin{matrix}#1\end{matrix}%
\endgroup]
}

\noindent % just for this example
columns of $\bcal{A}$ identical and its rank is reduced to~$2$, with the null
space of $\rowvector{-1/\sqrt{2} & 0 & 1/\sqrt{2}\,}\transpose$.
The other part of the condition shows that for an
$\mathbf{N}=\rowvector{N_{1} & N_{2} & N_{3}}\transpose$ in
$\bcal{A}$ null space to be a reasonable solution, $N_{1}=N_{3}$
must be satisfied.

\end{document}


• As better alternatives to \boldsymbol{\mathcal{...}}, mathalpha defines \mathbcal and unicode-math defines \mathbfcal or \symbfcal. Oct 2 '20 at 6:11

do not use \left and \right and no array:

columns of $\boldsymbol{\mathcal{A}}$ identical and its rank is reduced to 2, with the null space
of $\{ [-1/\sqrt{2} 0 1/\sqrt{2}]^{\text{T}}\}$. The other part of the condition
shows that for an $\mathbf{N}=[N_{1} N_{2} N_{3}]^{\text{T}}$
in $\boldsymbol{\mathcal{A}}$ null space to be
a reasonable solution, $N_{1}=N_{3}$ must be satisfied.


If you want some space between the elements write N_1\, N_2,...

• Somehow I checked their webpage version and it seems that the code they are using are the same as mine. They seem to have used \left \right and array so I was wondering if they use some additional package. Sep 5 '18 at 17:02
• You're short some space between elements within the vector...
– Werner
Sep 5 '18 at 17:45

In math mode there are plenty of options. The relevant one here might be \!  (bang-escape a space).

Overleaf has a great resource on the topic. Here is an extract from their excellent page:

\begin{align*}
f(x) &= x^2\! +3x\! +2 \\
f(x) &= x^2+3x+2 \\
f(x) &= x^2\, +3x\, +2 \\
f(x) &= x^2\: +3x\: +2 \\
f(x) &= x^2\; +3x\; +2 \\
f(x) &= x^2\ +3x\ +2 \\