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

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

  • 2
    This looks very odd, as if the math is drunk ;-) – Ulrike Fischer Oct 25 '17 at 16:21
  • @UlrikeFischer The alternative is like Sandy's solution, where the vinculum is misaligned. One must appreciate that such an application is the exception and not the norm, and so it would be, I think, unlikely to see a result in the actual form I present. – Steven B. Segletes Oct 25 '17 at 16:24
  • @UlrikeFischer On further consideration, lock me up! I'm guilty of drinking and deriving! – Steven B. Segletes Oct 25 '17 at 16:26
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

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

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}
  • 1
    This is not mathematical correct because [ ] is used for the integral part. – Vassilis Chasiotis Oct 25 '17 at 16:10
  • @VassilisChasiotis - Oh, I didn't realize what the [ and ] square brackets were for. I will edit my answer accordingly. – Mico Oct 25 '17 at 16:13
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

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

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.