Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I can create an angle bracket with the commands $\langle and \rangle$.

So if I want to say something like

IList<T>

I can achieve this with

IList $\langle T \rangle$

But I am unable to create double angled brackets. I am trying to say:

(Expression<Func<T, bool>>)

And I cannot get the two sets of angle brackets in place. Can anyone advise how I can get double angle brackets to work?

EDIT:

Actually, I just found that I can do the following to get double angle brackets:

$\llangle and \rrangle$

However, its still not possible to have two single left angle brackets followed by a double angle, which is what I need for the expression above.

share|improve this question

migrated from stackoverflow.com Sep 5 '11 at 20:04

This question came from our site for professional and enthusiast programmers.

1  
\rangle\rangle works for me. What problem do you have? –  Konrad Rudolph Sep 5 '11 at 12:25
    
Better use the listings package, which provides both inline and block verbatim environments for code display. –  Svante Sep 5 '11 at 15:45
    
I was pondering whether {symbols} or {punctuation} is more appropriate. I decided for the former because I (a non-mathematician) have never heard of "punctuation" in mathematical context. –  doncherry Sep 5 '11 at 21:00

3 Answers 3

up vote 6 down vote accepted

The following works for me:

Expression\(\langle\)Func\(\langle\)T, bool\(\rangle\rangle\)

(\(…\) is the same as $…$ but the latter is deprecated in LaTeX.)

Notice that you probably want to define macros for this to make it more readable:

\newcommand*\template[1]{\(\langle\)#1\(\rangle\)}
…
Expression\template{Func\template{T, bool}}
share|improve this answer
    
Expression(\langle)Func(\langle)T, bool(\rangle\rangle) worked perfectly thanks! –  JMc Sep 5 '11 at 13:06
    
I disagree that $…$ is deprecated. The moment it is removed, if ever, is the moment I'm assigning catcode 3 to $ myself! –  Andrey Vihrov Sep 5 '11 at 20:25
    
@Andrey Well, I’m merely referring what people from the LaTeX team (Joseph!) said. I’m however unable to find his original comment – you cannot search for those symbols. Either way, editors usually play nicer with \(…\) since it’s easier to infer a lexical range from it and unless you’re editing a really math-heavy text it just makes more sense. –  Konrad Rudolph Sep 5 '11 at 20:34

Assuming you're annoyed by the white-spaces due to the fact that < and > are treated as binary operators, and not opening / closing delimiters, you can try the following:

$(Expression\mathopen<Func\mathopen<T, bool\mathclose>\mathclose>)$
share|improve this answer

If you are trying to enter code fragments in LaTex you might be better using one of the packages (such as listings) that provide appropriate verbatim environments and commands.

If you just want a quick hack what about \verb|Expression<Func<T,bool>>|?

share|improve this answer

Your Answer

 
discard

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