Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
 $$\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)$$
share|improve this question

2 Answers 2

up vote 8 down vote accepted
  1. You should never use $$ in LaTeX, see Why is \[ … \] preferable to $$?

  2. “err” should be a math operator.

  3. Never use a ~ in math mode; multiplication doesn't want space.

  4. \left and \right add unwanted space when they surround the argument to a function.

  5. A \vec near a closed parenthesis needs a thin space.

  6. 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}

enter image description here

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}

enter image description here

share|improve this answer
    
Almost identical to what I was about to post, the only addition I had was to add phantom vertical spacing on the vector arrows \vec{x\vphantom{\theta} so that they are the same height. –  Peter Grill May 10 at 22:44
    
@PeterGrill I wouldn't do it; I wouldn't use the arrow for the vector, either. –  egreg May 10 at 22:48
    
@egreg: once more I forgot to check if an answer was posted while I was checking mine! However I have smaller parentheses through the use of nccmath for fractions. –  Bernard May 10 at 22:56
1  
Would look even better using \tfrac –  daleif May 11 at 7:40
1  
@Problemania For $$ see Why is \[ … \] preferable to $$?; for the operator you can use \operatorname{err} in the formula, which is better than \mathrm in this case (and is equivalent to what you get if you define \err as shown in the preamble). –  egreg May 11 at 17:52

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}

enter image description here

share|improve this answer
    
FYI, I used to use the nccmath package 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 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 \mathsmaller command from relsize. 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 at 23:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.