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'm afraid this is fairly obvious and has been asked many times, but I could not find the answer. I am having trouble getting an ampersand in a displayed formula in ConTeXt. I tried the obvious \&, and it seems fine outside math, i.e. this works:

\starttext
$\Pr$ (A \& B)
\stoptext

but this does not:

\starttext
\startformula
\Pr (A \& B)
\stopformula
\stoptext

(and using an unescaped '&' fails as well, unsurprisingly). Of course I could use \wedge or the word "and", but if at all possible I'd rather use an ampersand.

share|improve this question
    
What do you mean, with you sent it too soon? –  Dave Mar 11 '13 at 10:04
1  
I don't know Context, but in Latex, I would advise using the amsmath package and \text{\&}. Maybe you can adapt it to the Context syntax. –  T. Verron Mar 11 '13 at 10:31
4  
Here's a workaround: \appendtoks\def\&{\text{\letterampersand}}\to\everymathematics –  Marco Mar 11 '13 at 11:42
    
Take a look at the \with symbol from the cmll font - that is an ampersand figure that has been adapted from the Computer Modern ampersand for use in maths mode. If you like that, @Marco's trick together with a font import is what you need. –  Charles Stewart Mar 11 '13 at 13:46
    
@HendrikVogt Done! –  Thomas Junier Mar 11 '13 at 14:00

2 Answers 2

up vote 9 down vote accepted

By default there is no such command in math mode. However, you can switch to text mode where \& is available:

\starttext
  \startformula
    A \text{\&} B
  \stopformula
\stoptext

If you use \asciimode you don't even need the backslash:

\asciimode
\starttext
  \startformula
    A \text{&} B
  \stopformula
\stoptext

To avoid wrapping the ampersand in \text add the following code to your document. It redefines \& for both, inline and display math.

\appendtoks
  \def\&{\text{\letterampersand}}
\to\everymathematics

\starttext
  \startformula
    A \& B
  \stopformula

  \math{C \& D}

\stoptext
share|improve this answer

I used Detexify, which is a very usefull tool when you are looking for a special symbol. This way, I found the cmll package, containing the \with-command. I tried it in LaTeX:

\documentclass{minimal}
\usepackage{cmll}
\begin{document}
\[A \with B\]
\end{document}

and for me it worked well. I hope this works as well in ConTeX.

share|improve this answer
2  
It needs to be a ConTeXt solution. –  percusse Mar 11 '13 at 10:14
    
@percusse There is a long-standing agreement that we can have answers illustrating how other formats would tackle an issue. They are mainly ConTeXt answer to LaTeX questions, but the same idea applies in reverse. –  Joseph Wright Mar 12 '13 at 11:01
    
@JosephWright Sure I didn't mean that the answer is not suitable. It was a reminder but maybe not in a well-constructed comment. –  percusse Mar 12 '13 at 11:04

Your Answer

 
discard

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.