$$\mathrm{err} \left( h(\vec{\theta}, \vec{x}), y \right)
= \delta_{0y} ~ H \left( h(\vec{x}; \vec{\theta}) - \frac{1}{2} \right)
+ \delta_{1y} ~ H \left( \frac{1}{2} - h(\vec{x}; \vec{\theta}) \right)$$
2 Answers
You should never use
$$in LaTeX, see Why is\[ … \]preferable to$$?“err” should be a math operator.
Never use a
~in math mode; multiplication doesn't want space.\leftand\rightadd unwanted space when they surround the argument to a function.A
\vecnear a closed parenthesis needs a thin space.There's no need to have big parentheses for the argument to
err; I'd use normal size, but I show also how to get slighly bigger ones.
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\err}{err}
\begin{document}
First version
\[
\err( h(\vec{\theta}, \vec{x}\,), y )
= \delta_{0y} H \biggl( h(\vec{x}; \vec{\theta}\,) - \frac{1}{2} \biggr)
+ \delta_{1y} H \biggl( \frac{1}{2} - h(\vec{x}; \vec{\theta}\,) \biggr)
\]
Second version
\[
\err\bigl( h(\vec{\theta}, \vec{x}\,), y \bigr)
= \delta_{0y} H \biggl( h(\vec{x}; \vec{\theta}\,) - \frac{1}{2} \biggr)
+ \delta_{1y} H \biggl( \frac{1}{2} - h(\vec{x}; \vec{\theta}\,) \biggr)
\]
\end{document}

Other options include not having \DeclareMathOperator{\err}{err} in the preamble but the equivalent \operatorname{err} in the formula and using \tfrac{1}{2} as suggested by daleif, although I'm not sure about this. Here's the example.
\documentclass{article}
\usepackage{amsmath}
Third version
\[
\operatorname{err}\bigl( h(\vec{\theta}, \vec{x}\,), y \bigr)
= \delta_{0y} H \bigl( h(\vec{x}; \vec{\theta}\,) - \tfrac{1}{2} \bigr)
+ \delta_{1y} H \bigl( \tfrac{1}{2} - h(\vec{x}; \vec{\theta}\,) \bigr)
\]
\end{document}

Supposing it is a LaTeX document, first replace $$ … $$ with \[ … \]. Also define err as a math operator to have a correct horizontal spacing. Then you can use the nccmath package to use medium sized fractions, and replace \left … \right with the manually adjusted \Bigl … \Bigr:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{nccmath}
\DeclareMathOperator{\err}{err}
\begin{document}
\[ \err\bigl( h(\vec{\theta}, \vec{x}), y \bigr) = \delta_{0y}\,H\Bigl(h( \vec{x}; \vec{\theta}) - \mfrac{1}{2} \Bigr) + \delta_{1y}\, H\Bigl( \mfrac{1}{2} - h(\vec{x}; \vec{\theta}) \Bigr) \]
\end{document}

- 271,350
-
FYI, I used to use the
nccmathpackage package but ran into numerous issues that I decided to drop it. See Is there a replacement for nccmath? and the problems listed in the question. – Peter Grill May 10 '14 at 23:27 -
@Peter Grill: I know that (can't remember under which exact circumstances, but I never met those difficulties). The closest would be the
\mathsmallercommand fromrelsize. Maybe you should try to contact the author of nccmath — in my opinion, this concept of medium sized math formulae is really useful, as you can see from this example. – Bernard May 10 '14 at 23:33
\vec{x\vphantom{\theta}so that they are the same height. – Peter Grill May 10 '14 at 22:44nccmathfor fractions. – Bernard May 10 '14 at 22:56\[and\]. I had been using$and$$and it seems to do the job without me noticing anything wrong. – qazwsx May 11 '14 at 17:16\DeclareMathOperatorbut do it all in that equation itself? – qazwsx May 11 '14 at 17:17$$see Why is\[ … \]preferable to$$?; for the operator you can use\operatorname{err}in the formula, which is better than\mathrmin this case (and is equivalent to what you get if you define\erras shown in the preamble). – egreg May 11 '14 at 17:52