3

Edit by ManuelKuehner

! LaTeX Error: Bad math environment delimiter.

I am confused how to make the below formula in LaTeX:

I have been trying the below code, but it leads to an error:

\documentclass[runningheads,a4paper]{llncs}

\usepackage{amssymb}
\setcounter{tocdepth}{2}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{url}

\usepackage{float}
\usepackage{booktabs}
\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage{hhline}% http://ctan.org/pkg/hhline

\usepackage{lipsum}
\setcounter{secnumdepth}{5}
\begin{document}



\begin{equation}
    P(Attack¦Asset)  = \[\frac{\,\ attack,\ asset}\]
\end{equation}

\end{document}
  • I got ! LaTeX Error: File llncs.cls' not found.`. Please tell us which error you are getting. – Dr. Manuel Kuehner Jun 18 '17 at 15:31
  • Remove \[ and \] from the equation. (And probably you also want to use package amsmath and use \text{...} for the text parts of the equation.) – clemens Jun 18 '17 at 15:34
  • The \[ \] within equation are superfluous. – Bernard Jun 18 '17 at 15:34
  • 1
    \frac needs two arguments but you only provided one, that's an additional error. – Skillmon Jun 18 '17 at 15:59
4
  • Here's a starting point.
  • Asset and Attack are words and not variables I guess so I used \text from the amsmath package (loaded by mathtools). Both are famous and standard packages for math stuff.
  • You used \[ and \] inside a math environment -- I guess it's just copy and paste from somewhere. This was an error. See What are the differences between $$, \[, align, equation and displaymath?.

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation}
    P(\text{Attack} \mid \text{Asset})  = \frac{P(\text{Attack} \cap \text{Asset})}{P(\text{Asset})}
\end{equation}

\end{document}

enter image description here


I didn't know the funny arc symbol so I looked in detexify.

enter image description here

  • 2
    Probably \mid would look better than |. – Bernard Jun 18 '17 at 15:35
  • 1
    You should address the real error in the question, namely using \[ and \] inside equation! – clemens Jun 18 '17 at 15:37
  • @Bernard Done :) – Dr. Manuel Kuehner Jun 18 '17 at 15:37
  • @clemens I am still typing...but yes – Dr. Manuel Kuehner Jun 18 '17 at 15:38
  • @Dr.ManuelKuehner you post your answers before you've finished them? o.O – clemens Jun 18 '17 at 15:39
3

From the mathtools manual mostly.... Note that the spacing is correct everywhere.

enter image description here

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter\parens()
\providecommand\given{}
\newcommand\Symbol[1][]{%
    \nonscript\:#1\vert
    \allowbreak
    \nonscript\:
    \mathopen{}}
\DeclarePairedDelimiterX\condr[1](){\renewcommand\given{\Symbol[\delimsize]}#1}


\begin{document}
\[
\Pr\condr{\text{Attack} \given \text{Asset}} = \frac{ \Pr\parens{ \text{Attack} \cap \text{Asset}} }{\Pr\parens{\text{Asset}}}
\]
\end{document}

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.