6

The following minimal working example generates an error if you remove the per cent sign.

\documentclass{amsart}
%\usepackage{tipa}
\usepackage{braket}
\begin{document}
\[
\Set{x|y}
\]
\end{document}

The error message:

LaTeX Warning: Command \: invalid in math mode on input line 6.
LaTeX Warning: Command \: invalid in math mode on input line 6.
LaTeX Warning: Command \; invalid in math mode on input line 6.
LaTeX Warning: Command \; invalid in math mode on input line 6.
! Missing } inserted.
<inserted text> 
                }
l.6 \Set{x|y}
0

2 Answers 2

9

The tipa package redefines some standard commands and this is the cause for the errors you get, but provides a “compatibility” layer. Notably the command it redefines are

  • \s (alias \textsyllabic)
  • \* (no alias provided)
  • \| (no alias provided)
  • \: (alias \tipamedspace)
  • \; (alias \tipathickspace)
  • \! (alias \tipanegthinspace)

If you call the package with the safe option, that is,

\usepackage[safe]{tipa}

the redefinitions are not performed. Section 3.1.3 of the tipa manual.

1

Note that in braket.sty there is:

{\catcode`\|=\active
  \xdef\set{\protect\expandafter\noexpand\csname set \endcsname}
  \expandafter\gdef\csname set \endcsname#1{\mathinner
        {\lbrace\,{\mathcode`\|32768\let|\midvert #1}\,\rbrace}}
  \xdef\Set{\protect\expandafter\noexpand\csname Set \endcsname}
  \expandafter\gdef\csname Set \endcsname#1{\left\{%
     \ifx\SavedDoubleVert\relax \let\SavedDoubleVert\|\fi
     \:{\let\|\SetDoubleVert
     \mathcode`\|32768\let|\SetVert
     #1}\:\right\}}
}
\def\midvert{\egroup\mid\bgroup}
\def\SetVert{\@ifnextchar|{\|\@gobble}% turn || into \|
    {\egroup\;\mid@vertical\;\bgroup}}
\def\SetDoubleVert{\egroup\;\mid@dblvertical\;\bgroup}

The detail what the code does exactly is not important, however note that \: and \; is used in the code. If tipa redefines these commands, of course there will be problems.

One way is to redefine these macros in braket.sty.

%! TEX program = pdflatex
\documentclass{amsart}
\usepackage{tipa}
\usepackage{braket}


\makeatletter
{\catcode`\|=\active
  \xdef\set{\protect\expandafter\noexpand\csname set \endcsname}
  \expandafter\gdef\csname set \endcsname#1{\mathinner
        {\lbrace\,{\mathcode`\|32768\let|\midvert #1}\,\rbrace}}
  \xdef\Set{\protect\expandafter\noexpand\csname Set \endcsname}
  \expandafter\gdef\csname Set \endcsname#1{\left\{%
     \ifx\SavedDoubleVert\relax \let\SavedDoubleVert\|\fi
     \medspace{\let\|\SetDoubleVert
     \mathcode`\|32768\let|\SetVert
     #1}\medspace\right\}}
}
\def\midvert{\egroup\mid\bgroup}
\def\SetVert{\@ifnextchar|{\|\@gobble}% turn || into \|
    {\egroup\thickspace\mid@vertical\thickspace\bgroup}}
\def\SetDoubleVert{\egroup\thickspace\mid@dblvertical\thickspace\bgroup}
\makeatother

\begin{document}
\[
\Set{x|y}
\]
\end{document}

Another way is to use \tipasafemode every time you need \Set, as suggested in tipa documentation (this is obviously clunky).

%! TEX program = pdflatex
\documentclass{amsart}
\usepackage{tipa}
\usepackage{braket}
\begin{document}
{\tipasafemode
\[
\Set{x|y}
\]
}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .