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}
Jimmy
  • 281

2 Answers2

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

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}
JPi
  • 13,595