I have a problem with LaTeX – I don't know how to put mathematical equations and symbols in listings. I use the listings
package and it's offers great looking listings, but it doesn't allow math symbols in $ ... $
. Another package, algorithms
, allows math, but listings doesn't look as good as with listings
(the problem is that algorithms
demands to get new line after every if
, then
, etc.)
The symbol ∈ indicates set membership and means “is an element of” so that the statement x∈A means that x is an element of the set A. In other words, x is one of the objects in the collection of (possibly many) objects in the set A.
∩ The symbol ∩ means intersection. Given two sets S and T, S ∩ T is used to denote the set {x|x ∈ S and x ∈ T}. For example {1,2,3}∩{3,4,5} = {3}.
∧ or (English symbol name wedge) (mathematics, logic) The conjunction operator, forming a Boolean-valued function, typically with two arguments, returning true only if all of its arguments are true.
You can use the option mathescape
for your environment which gives you the ability to use the normal latex behavior of the $-signs. Try:
\begin{lstlisting}[mathescape] ... \end{lstlisting}
For more info, take a look into the listings
package manual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With