5

I have the following code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    $c_{1}=\left[\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}\right]$
\end{document}

which gives:

enter image description here

Why do I have this blank space which is colored by red? Is there any way to remove it?

6 Answers6

8

Like Mico I would try to avoid that the upper part is so much larger.

\documentclass{article}
\usepackage{amsmath}



\begin{document}
    $c_{1}=\left[\dfrac{m\left(\frac{N}{q}-1\right)}{N-1}\right]$\quad     
    $c_{1}=\left[\dfrac{m\left(N/q-1\right)}{N-1}\right]$
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
8

My two cents:

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

\begin{document}

\section{Ugly}
\[
c_{1}=\left[\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}\right]
\]

\section{Bad}
\[
c_{1}=
\sbox0{$\displaystyle\frac{m\biggl(\dfrac{N}{q}-1\biggr)}{N-1}$}
\raisebox{\dimexpr\depth-\dp0}{%
  $
  \begin{array}\lbrack{@{}c@{}}\rbrack
  \displaystyle\frac{m\biggl(\dfrac{N}{q}-1\biggr)}{N-1}
  \end{array}
  $%
}
\]

\section{Good}
\[
c_{1}=
\left[\frac{1}{N-1}\cdot m\biggl(\frac{N}{q}-1\biggr)\right]
\]

\end{document}

enter image description here

egreg
  • 1,121,712
6

Just \fixit[]{}{}{}! The syntax is

\fixit[<mathstyle>]{<left-delim>}{<content>}{<right-delim>}

The MWE:

\documentclass{article}
\usepackage{amsmath}
\newcommand\fixit[4][\displaystyle]{
  \setbox0=\hbox{$#1#3$}
  \setbox2=\hbox{$\vcenter{\copy0}$}
  \raisebox{\dimexpr\ht0-\ht2}{$#1\left#2\copy2\right#4$}
}
\begin{document}
    $c_{1}=\fixit{[}{\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}}{]}
    \ne\fixit{[}{\dfrac{N-1}{m\left(\dfrac{N}{q}-1\right)}}{]}$

    $c_{1}=\fixit[\textstyle]{[}{\frac{m\left(\frac{N}{q}-1\right)}{N-1}}{]}
    \ne\fixit[\textstyle]{[}{\frac{N-1}{m\left(\frac{N}{q}-1\right)}}{]}$
\end{document}

enter image description here

5

You can use bmatrix and consider the expression to be an entry in a 1x1 matrix.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$c_{1}=\begin{bmatrix}\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}\end{bmatrix}$
\end{document}

This will also vertically center the = sign (which may or may not be desirable).

enter image description here

Sandy G
  • 42,558
5

(Edited the answer to incorporate the information, provided by the OP, that the square brackets are supposed to denote the "integer part" of the argument.)

I truly think your best option is to rewrite the term so as to avoid having to display a three-level fraction. In the following screenshot, the first term is from your code, the second is from @jfbu's answer, and the third implements the suggested rewrite, where I'm using a macro called \floor for the sake of variety of appearances.

enter image description here

\documentclass{article}
\usepackage{mathtools,mleftright}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\begin{document}
\[
c_{1}
=\left[\frac{m\left(\dfrac{N}{q}-1\right)}{N-1}\right]\\
=\raisebox{\dimexpr.25\height+1pt}{$\displaystyle\left[\raisebox{-.25\height}{$\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}$}\right]$}\\
=\floor*{\frac{m}{N-1}\mleft(\frac{N}{q}-1\mright)}
\]
\end{document}
Mico
  • 506,678
2

Quick hack

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    $c_{1}=\raisebox{\dimexpr.25\height+1pt}{$\displaystyle\left[\raisebox{-.25\height}{$\dfrac{m\left(\dfrac{N}{q}-1\right)}{N-1}$}\right]$}$
\end{document}

enter image description here

The cause of your troubles is that TeX positions delimiters symmetrically with respect to math axis. I did not make the utmost effort here to get the fraction rule exactly at math axis after my surgery.


More detailed and complete answers at Proper display of fractions

  • actually this looks quite similar to https://tex.stackexchange.com/a/59750/4686 pointed out by @StevenSegletes. And https://tex.stackexchange.com/a/251919/4686 possibly better yet. –  Oct 25 '17 at 16:04