0

How to write this formula in Latex?

enter image description here

I tried this, but it does not work and I dont know why nor k=how to improve it.

$frac{$$w$^{$T$}\times($x$ - $x$)$\}{$w$}$

Moreover, I dont know how to prite the Xpos and Xneg and the ||w||.

Can you help me please?

  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.

    • Note this is a Q&A site, not a please do this for me service. What do you have so far.

    – albert Sep 04 '20 at 09:05
  • Thank you @albert! I improved my question. – Ariadne R. Sep 04 '20 at 09:15
  • 2
    I would recommend reading a good basic introduction to latex. You should not be going in and out of math-moce like that. $\frac{w^{T}(x_{\mathrm{pos}}-x_{\mathrm{neg}})}{\lVert w\rVert} = \frac{2}{\lVert w\rVert}$ – daleif Sep 04 '20 at 09:17

1 Answers1

2

I would load newtxtext, newtxmath, mathtools and bm (to have boldmath), define the \norm command with

   \DeclarePairedDelimiter{\norm}\lVert\rVert

and code the formula as

\[\bm{\frac{w^T\bigl(x_{\textbf{\scriptsize pos}}-x_{\textbf{\scriptsize neg}}\bigr)}{\norm{x}}=\frac{\text{2}}{\norm{w}}} \]

enter image description here

Bernard
  • 271,350
  • I have two suggestions. First, the fraction numerator on the RHS should not be in bold. Second, we might consider loading the appropriate fonts, e.g., by \usepackage{mathptmx}. – Marian G. Sep 04 '20 at 09:48
  • Yes, I overlooked the details. For the font, I'd prefer newtx, which will be more complete. – Bernard Sep 04 '20 at 10:22
  • 1
    I would use LuaLaTeX and unicode-math when you can, and PDFTeX with 8-bit legacy fonts when you have to. To get math that looks like Times with unicode-math, you \setmathfont{TeX Gyre Termes Math} and \setmainfont{TeX Gyre Termes}. Times New Roman also works. – Davislor Sep 04 '20 at 12:02