TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get this to work:

    \item[\texttt{foo :: a \rightarrow b}] bla

without having to write:



  • \ttfamily: for typewriter formating
  • ~: to get the spacing right(??)
  • $: to activate math mode
  • \normalfont: to get back to normal
  • last ~: insert simple space(??)

or how would you list some function definitions and append a description for the functions?

share|improve this question
Clear duplicate of tex.stackexchange.com/questions/2245/… – frabjous Aug 24 '10 at 15:21
@frabjous: no, the other question is about \verb. – Caramdir Aug 24 '10 at 15:30
up vote 2 down vote accepted

How about

    \item[\texttt{foo :: a $\rightarrow$ b}] bla

That is: add a closing brace and $s around \rightarrow.

Or maybe you want

    \item[\texttt{[foo ::~a $\rightarrow$ b]}] bla
share|improve this answer
arg, sorry. I was fiddling around with item formatting all day long I started to believe you can't use formatting in item[] at all... Should I delete the question? – Gerold Meisinger Aug 24 '10 at 15:44
I don’t see a reason to do so. – Caramdir Aug 24 '10 at 15:48

In this case I would \usepackage{enumitem}

And then write:

    \item[foo :: a $\rightarrow$ b] bla

This way you don't need to define the font for each of your items.

share|improve this answer
In my opinion, this should be the accepted answer. – I Like to Code Apr 15 '14 at 14:02

i notice you're missing a closing brace before the closing bracket, other than that the two seem to produce identical output for me, save the enclosing brackets in your second example.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.