I would like to use \scshape in LaTeX math mode, but my LaTeX complains
that:
! LaTeX Error: Command \scshape invalid in math mode.
Several places on the Internet suggest using \mathsc but I get:
! Undefined control sequence.
\avmatrix -> \left [ \hskip -\arraycolsep \mathsc
\begin {array}{ll}
I'm trying to define my own avmatrix environment which creates
two-column (attribute/value) matrices with all the letters presented in
smallcaps.
Here is my definition (without smallcaps):
\newenvironment{avmatrix}{
\left[
\hskip -\arraycolsep
\begin{array}{ll}
}
{
\end{array}
\hskip -\arraycolsep
\right]
}
and here is an example usage:
$$
\begin{avmatrix}
married & - \\
phone & 3245 \\
name & Jones \\
office & D11 \\
\end{avmatrix}
$$
Any help would be appreciated.
Peter.
Use \textsc{...} instead!
In general, \text... commands work in math mode, too,
while the corresponding declarations don't.
HTH
Walter
Walter Schmidt wrote:
> Peter-Frank Spierenburg schrieb:
>
>>I would like to use \scshape in LaTeX math mode but my LaTeX complains
>>
>>! LaTeX Error: Command \scshape invalid in math mode.
>
>
> Use \textsc{...} instead!
Tried it. Got the following error message.
! Missing \endgroup inserted.
<inserted text>
\endgroup
Peter.
>>> I would like to use \scshape in LaTeX math mode but my LaTeX complains
>>> ! LaTeX Error: Command \scshape invalid in math mode.
>>
>>
>>
>> Use \textsc{...} instead!
>
>
> Tried it. Got the following error message.
\documentclass{article}
\parindent=0pt
\newenvironment{avmatrix}{%
\begin{center}
\sc $\left[
\hskip -\arraycolsep
\begin{tabular}{ll}
}{%
\end{tabular}
\hskip -\arraycolsep
\right]$%
\end{center}
}
\begin{document}
blah
\begin{avmatrix}
married & - \\
phone & 3245 \\
name & Jones \\
office & D11 \\
\end{avmatrix}
blah
\end{document}
I've tried it, too, and it worked for me.
Since you did not post an example to reproduce
the above problem, I can only guess that you don't
understand the syntax of the \textsc commands,
which differs from \scshape. It works like this:
\textsc{... some Text ...}
It's a command with an argument, whereas \scshape
is a declaration. Please, consult any LaTeX
introduction!
Walter
Walter Schmidt wrote:
> Peter-Frank Spierenburg schrieb:
>
>>>>I would like to use \scshape in LaTeX math mode but my LaTeX complains
>>>>
>>>>! LaTeX Error: Command \scshape invalid in math mode.
>>>
>>>
>>>Use \textsc{...} instead!
>>
>>Tried it. Got the following error message.
>>
>>! Missing \endgroup inserted.
>><inserted text>
>> \endgroup
>
>
> I've tried it, too, and it worked for me.
>
> Since you did not post an example to reproduce
> the above problem, I can only guess that you don't
> understand the syntax of the \textsc commands,
> which differs from \scshape. It works like this:
>
> \textsc{... some Text ...}
Yes, I understand. But how do I embed that inside an environment
definition? i.e. I want to define my own environment which uses the
small-caps shape. I tried the following:
\newenvironment{avmatrix}{
\left[
\hskip -\arraycolsep
\begin{textsc}
\begin{array}{ll}
}
{
\end{array}
\end{textsc}
\hskip -\arraycolsep
\right]
}
If I replace \begin{textsc} with \textsc{ and the \end{textsc} with a }
I cannot imagine a parser which would be capable of properly parsing
such a mess.
The idea is to be able to change the font declaration in one place (the
environment definition) and have it change everywhere in my document.
Peter.