I'm trying to highlight the diagonal elements of a matrix by using fbox but I failed. I've searched for the problem, some ppl suggest using tikz. I don't want to use it, so I decided to use fbox{}. Every time I do the following

\documentclass[a4paper, 12pt]{article}
       \sigma_{xx} & \sigma_{yx}        \\
       \sigma_{xy} & \fbox{\sigma_{yy}} \\

it throws an error !Argument of \align has an extra} if I remove \sigma_{}, it works. Any suggestions?

  • 3
    Use \boxed and not \fbox – egreg Dec 8 '14 at 9:44

\fbox sets its argument in text mode, and \sigma as well as the subscript requires math mode. So, use \fbox{$\sigma_{yy}$} or the \boxed version supplied by amsmath:

enter image description here

  \boxed{\sigma_{xx}} & \sigma_{yx}          \\
  \sigma_{xy}         & \fbox{$\sigma_{yy}$}

Also, there's no need for align here, and I'd rather use an equation (if you want it numbered) or \[...\] if not.

  • 3
    Which is exactly the same as using \boxed from amsmath, \boxed{...} = \fbox{$...$} (almost) – daleif Dec 8 '14 at 8:47
  • @daleif \boxed also issues \displaystyle while \fbox{$...$} would be in \textstyle. – Skillmon Apr 16 '19 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.