
我們已經將\boxed
內容設定為下標,
但下標大小未更新,請建議如何使用\boxed
定義設定腳本大小。
請找到MWE檔案:
\documentclass{book}
\usepackage{amsmath}
\makeatletter
\renewcommand{\boxed}[1]{\fboxsep1pt\arraycolsep1pt\fbox{\m@th$#1$}}
\makeatother
\begin{document}
the passenger moving with a velocity of +11 m/s, due in part to the walking motion and in part to the train's motion. As $\boxed{\begin{array}{c}
{PT}\\
{AT}\\
{CT}\\
\end{array}}$ the passenger moving with a velocity of +11 m/s, due in part to the walking motion and in part to the train's motion. As
$$\vec{\mathbf{V}}_{\boxed{\begin{array}{c}
{PT}\\
{AT}\\
{CT}\\
\end{array}}}$$
\end{document}
答案1
使用 TABstacks 的方法:
\documentclass{book}
\usepackage{amsmath,scalerel,tabstackengine}
\TABstackMath
\TABstackMathstyle{\SavedStyle}
\renewcommand{\boxed}[1]{\ThisStyle{\fboxsep1pt\fbox{%
\setstackgap{L}{12\LMpt}\tabbedCenterstack{#1}}}}
\begin{document}
the passenger moving with a velocity of +11 m/s, due in part to the walking
motion and in part to the train's motion. As $\boxed{PT\\AT\\CT}$ the
passenger moving with a velocity of +11 m/s, due in part to the walking
motion and in part to the train's motion. As
\[
\vec{\mathbf{V}}_{\boxed{PT\\AT\\CT}}
\]
\end{document}
答案2
您可以使用\text
from amsmath
,但您需要在基線方面提供協助。
\documentclass{book}
\usepackage{amsmath}
\usepackage{array}
\usepackage{siunitx}
\sisetup{retain-explicit-plus}
\makeatletter
\newcommand{\boxedarray}[2][c]{%
\begingroup
\let\current@f@size\f@size
\setlength\fboxsep{1pt}%
\text{\fbox{\fix@baseline$\begin{array}[#1]{c}#2\end{array}$}}%
\endgroup
}
\newcommand{\fixbaseline}{%
\ifx\f@size\current@f@size\else\ifx\f@size\sf@size\linespread{0.7}\else\linespread{0.5}\fi\fi
\selectfont
}
\makeatother
\begin{document}
The passenger moving with a velocity of \SI{+11}{m/s}, due in part to the
walking motion and in part to the train's motion. As
$\boxedarray{ PT \\ AT \\ CT }$
the passenger moving with a velocity of \SI{+11}{m/s}, due in part to the
walking motion and in part to the train's motion. As
\[
\vec{\mathbf{V}}_{\boxedarray{ PT \\ AT \\ CT }}
\]
\end{document}
對於單位,正如已經建議的那樣,使用siunitx
設施。
答案3
我提出了一個非常簡單的\subboxed
命令,它確保數學將在 \scriptstyle 中並且 的值\boxsep
被調整。在正文中,我只需使用盒裝\Vectorstack
的stackengine
.
與問題無關:我使用了 中的可擴展向量箭頭,它看起來比粗體 V esvec
更好。\vec
\documentclass{book}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage[b]{esvect}
\usepackage[usestackEOL]{stackengine}
\newcommand{\subboxed}[1]{{\setlength{\fboxsep}{1pt}\boxed{\everymath{\scriptstyle}#1}}}
\begin{document}
The passenger moving with a velocity of \SI{+11}{\meter/\second}, due in part to the walking
motion and in part to the train's motion. As $\boxed{\Vectorstack{PT \\ AT \\ CT}}$ the passenger moving with a velocity of \SI{+11}{\meter/\second},
due in part to the walking motion and in part to the train's motion. As
\[\vv{\mathbf{V}}_{\subboxed{\substack{PT\\ AT \\ CT}}}
\]
\end{document}
答案4
這可能太天真了,但您不需要任何複雜的\makeatletter
東西來裝箱數組。
\documentclass{book}
\usepackage{amsmath}
\usepackage{siunitx}
\begin{document}
The passenger moving with a velocity of \SI{+11}{\meter/\second}, due in part to the walking
motion and in part to the train's motion. As $\begin{array}{|@{\,}c@{\,}|}
\hline
{PT}\\
{AT}\\
{CT}\\
\hline
\end{array}$ the passenger moving with a velocity of \SI{+11}{\meter/\second},
due in part to the walking motion and in part to the train's motion. As
\[\vec{\mathbf{V}}_{\begin{array}{|@{\,}c@{\,}|}
\hline
{PT}\\
{AT}\\
{CT}\\
\hline
\end{array}}\]
\end{document}
當然,問題是讀者是否想要這樣的盒子。 (至少我添加siunitx
並替換$$ ... $$
為\[ ... \]
所以這可能不是完全沒有意義的。)