Я бы хотел сделать что-то похожее \boxed{whatever}
, но с коробкой, открытой с одной стороны. Что-то вроде следующего.
\documentclass{article}
\begin{document}
\[
\overline{\underline{abc |}}
\]
\end{document}
что приводит к следующему результату (некрасивому, но концептуально близкому к тому, что я хочу):
Думаю, есть простой способ сделать то, что мне нужно, но я не смог его найти.
решение1
Так ?
С tcolorbox:
\documentclass{article}
\usepackage{tcolorbox}
\newtcbox{\boxed}{on line,colframe=black,colback=white,sharp corners,
before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}
\begin{document}
Quick brown fox \boxed{jumped} over the lazy dog.
\end{document}
решение2
решение3
Ответ с tikz:
\documentclass{article}
\usepackage{tikz}
\usepackage{parskip}
\setlength{\parskip}{15pt}
\newsavebox{\mybox}
\newcommand{\PutInsideOpenBox}[3][-,black]{\ifdefined\extraxskip\relax\else\xdef\extraxskip{1pt}\fi\ifdefined\extrayskip\relax\else\xdef\extrayskip{3.5pt}\fi\savebox{\mybox}{\vbox{\hbox{#3}}}\begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]\node at ({\wd\mybox/2},{(\ht\mybox+\dp\mybox)/2}){\usebox{\mybox}};
\draw[#1]({-\extraxskip},{-\extrayskip})--({\wd\mybox+\extraxskip},{-\extrayskip})--({\wd\mybox+\extraxskip},{(\ht\mybox+\dp\mybox)+\extrayskip})--({-\extraxskip},{(\ht\mybox+\dp\mybox)+\extrayskip});\end{tikzpicture}}
\begin{document}
\[
\PutInsideOpenBox{0pt}{
abc
}\]
In text: \(\PutInsideOpenBox[-,thick,red]{0pt}{AbcD}\) that will expand in two lines and we will see that the baselineskip is slightly increased
Increasing borders:
\def\extraxskip{3pt}
\def\extrayskip{6pt}
In text: \(\PutInsideOpenBox[-,thick,red]{0pt}{AbcD}\) that will expand in two lines and we will see that the baselineskip is enough increased
An equation:
\[
\PutInsideOpenBox{2.5pt}{f(x)}=x\cdot \PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
\]
\end{document}
решение4
Сfbox
упаковка:
\documentclass{article}
\usepackage{fbox}
\begin{document}
\fbox[trb]{abc} \fbox[tlb]{abc}
\end{document}