[Tex/LaTex] Missing delimiter (. inserted). error

equationserrors

I'm trying to type up a fairly annoying closed form, and I don't understand why it isn't letting me typeset it.

The equation is this:

$P_{n}=4\times\bigg(\dfrac{1}{2}\bigg)^{\big{\lfloor\frac{n+1}{2}\rfloor-1}}\times\bigg(2\bigg)^{\big{\frac{3-(-1)^{n}}{4}}}

When I place the \big command in the first index (when raising half to the power of the floor function), it works just fine. But when I do exactly the same to the next index, it returns the Missing delimiter (. inserted). error.

I tried looking into what that error means, but only seemed to be able to find answers specific to particular pieces of code. From what I gathered, the code is telling me that I need to put a . somewhere in order to nullify a delimiter, but I don't have any delimiters that need nullifying to my understanding; I need all of them!

Apologies for any un-neatness. This is only my second question and I'm still learning the TeX language.

Thanks for your time and patience,

Eliot.

Best Answer

Pretty annoying indeed. But I'd use the slashed form for 1/2 and \tfrac for the fractions in the exponents. However, this needs some corrections, because the exponent would hide the base, without them. So I propose to raise the exponents by some amount. In order to fix also the alignment of the fraction numerators, a \mathstrut is used for n+1 to compensate for the parentheses in (-1) in the other exponent. Finally, \bigl and \bigr are used for the floor parentheses because \left and \right would produce too big fences.

The auxiliary macro \makehigher pretends that the base is higher than its natural height by adding an invisible rule.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\makehigher}[2][3]{%
  {\rule{0pt}{#1ex}#2}%
}


\begin{document}
\[
P_{n}=4\cdot
\makehigher{(1/2)}^{\bigl\lfloor\tfrac{\mathstrut n+1}{2}\bigr\rfloor-1}\cdot
\makehigher{2}^{\tfrac{3-(-1)^{n}}{4}}
\]
\end{document}

Adjust the amount of raising (default 3ex) by using the optional argument; you could try \makehigher[2.5]{...}).

Here's a picture where I added also a rule to show that the fraction lines in the exponents are level with each other.

enter image description here

Related Question