tags:

views:

578

answers:

3

Hey,

I try to write the following in latex:

\begin{itemize}
    \item \textbf{insert(element|text)} inserts the element or text passed at the start of the selection.
    \item \textbf{insert_after(element|text)} inserts the element or text passed at the end of the selection.
    \item \textbf{replace(element|text)} replaces the selection with the passed text/element.
    \item \textbf{delete()} deletes the selected text.
    \item \textbf{annotate(name,value)} annotates the selected text with the passed name and value-pair. This can either be a hidden meta-data about the selection, or can alter the visible appearance.
    \item \textbf{clear_annotation()} removes any annotation for this specific selection.
    \item \textbf{update_element(value)} performs an update of the element at the selection with the passed value.
\end{itemize}

For some reason, I get a bunch of errors. I think there is something with the use of the word "insert". I get errors like "Missing $ inserted", so it seems like the parses tries to fix some "errors" on my parts. Do I need to escape words like "insert", how do I do that?

+5  A: 

The "Missing $ inserted" is probably due to the underscores and bars. These characters in LaTeX have special meaning in math mode (which is delimited by $ characters). To fix it, try escaping them; e.g. insert\_after.

Also, if you're trying to represent code, you could try using the \verb command to make it clearer/more consistent.

Will Vousden
This did the trick! Thanks! =)
Espenhh
+1  A: 

My first guess is that LaTeX chokes on | outside a math environment. Missing $ inserted is usually a symptom of something like that.

High Performance Mark
As @Will points out, LaTeX doesn't like _ . Looks like a better explanation than mine too.
High Performance Mark
+3  A: 

It's actually the underscores. Use \_ instead, or include the underscore package.

Cirno de Bergerac