2

I want to create something the image below on Latex. So essentially it is a math function which is surrounded by a box with a superscript. And boxes can be within other boxes.

Any thoughts?

Thanks you very much!

picture example

2

The use of scalerel's \ThisStyle{...\SavedStyle...} feature allows \mathbox to be applied to super/subscripts as well (e.g., ...^{\mathbox{F}}) and retain its proper scriptsize nature.

\documentclass{article}
\usepackage{scalerel}
\newcommand\mathbox[1]{\mathord{\ThisStyle{%
  \fboxsep3\LMpt\relax\kern1\LMpt\fbox{$\SavedStyle#1$}\kern1\LMpt}}}
\begin{document}
\[
\mathbox{\neg s}^T \rightarrow \mathbox{
\Bigl(\mathbox{(\mathbox{r}^T\rightarrow \mathbox{\neg p}^F)
}^F \vee \mathbox{\neg t}^F\Bigr)}^F
\]

\[\mathbox{a}^{\mathbox{b}^{\mathbox{c}}}\]
\end{document}

enter image description here

3

You can use \boxed of amsmath with some help:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\boxsym}[1]{%
  \mathord{\mspace{2mu}\boxed{\vphantom{by}#1}\mspace{1mu}}%
}

\begin{document}
\[
\boxsym{\lnot s}^T \rightarrow
\boxsym{
  \biggl(\boxsym{
    \bigl(\boxsym{r}^T\rightarrow \boxsym{\lnot p}^F\bigr)
  }^F \vee \boxsym{\lnot t}^F\biggr)
}^F
\]
\end{document}

enter image description here

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.