math commands outside math environment

TXS - Help
2013-11-12
2013-11-13
  • Kevin Williams
    Kevin Williams
    2013-11-12

    Hi

    I've just stumbled on TeXStudio. Looks wonderful.

    I'm generating TeX output from some mathematics software. I figured out some of the issues using help from this forum by enabling manually some CWL options, including all the ams* stuff, and mathtool, and also the latex-mathsymbols.

    This has got me a bit stumped though. It does not like the \sigma in this lot:

    The error is "math command outside math env". If it is INSIDE an {array} section, it is happy though?

    Can anyone help?

    Many thanks

    \begin{doublespace}
    \noindent\(\left\{\left\{\text{$\sigma $pxn}^2,0,0,0,0,0,0,0,0,0,0,0\right\},\left\{0,\text{$\sigma $pyn}^2,0,0,0,0,0,0,0,0,0,0\right\},\left\{0,0,\text{$\sigma
    $pzn}^2,0,0,0,0,0,0,0,0,0\right\},\left\{0,0,0,\text{$\sigma $vxn}^2,0,0,0,0,0,0,0,0\right\},\left\{0,0,0,0,\text{$\sigma $vyn}^2,0,0,0,0,0,0,0\right\},\left\{0,0,0,0,0,\text{$\sigma
    $vzn}^2,0,0,0,0,0,0\right\},\left\{0,0,0,0,0,0,\sigma \alpha ^2,0,0,0,0,0\right\},\left\{0,0,0,0,0,0,0,\sigma \beta ^2,0,0,0,0\right\},\left\{0,0,0,0,0,0,0,0,\sigma
    \gamma ^2,0,0,0\right\},\left\{0,0,0,0,0,0,0,0,0,\text{$\sigma $Rpxn}^2,0,0\right\},\left\{0,0,0,0,0,0,0,0,0,0,\text{$\sigma $Rpxn}^2,0\right\},\left\{0,0,0,0,0,0,0,0,0,0,0,\text{$\sigma
    $Rpxn}^2\right\}\right\}\)
    \end{doublespace}
    
     
    • the syntax checker can't handle the \text{...} command correctly.
      And then you started a math env inside a \text option which disables the
      surrounding math env.
      Alternatively you could place \sigma before the \text command.

      On 12.11.2013 15:47, Kevin Williams wrote:

      \begin{doublespace}
      \noindent(\left{\left{\text{$\sigma $pxn}^2,0,0,0,0,0,0,0,0,0,0,0\right},\left{0,\text{$\sigma $pyn}^2,0,0,0,0,0,0,0,0,0,0\right},\left{0,0,\text{$\sigma
      $pzn}^2,0,0,0,0,0,0,0,0,0\right},\left{0,0,0,\text{$\sigma $vxn}^2,0,0,0,0,0,0,0,0\right},\left{0,0,0,0,\text{$\sigma $vyn}^2,0,0,0,0,0,0,0\right},\left{0,0,0,0,0,\text{$\sigma
      $vzn}^2,0,0,0,0,0,0\right},\left{0,0,0,0,0,0,\sigma \alpha ^2,0,0,0,0,0\right},\left{0,0,0,0,0,0,0,\sigma \beta ^2,0,0,0,0\right},\left{0,0,0,0,0,0,0,0,\sigma
      \gamma ^2,0,0,0\right},\left{0,0,0,0,0,0,0,0,0,\text{$\sigma $Rpxn}^2,0,0\right},\left{0,0,0,0,0,0,0,0,0,0,\text{$\sigma $Rpxn}^2,0\right},\left{0,0,0,0,0,0,0,0,0,0,0,\text{$\sigma
      $Rpxn}^2\right}\right})
      \end{doublespace}

       
  • Kevin Williams
    Kevin Williams
    2013-11-13

    Thanks! Got it working!