텍스트 주위에 선을 그리지만 한쪽만 열려면 어떻게 해야 합니까?

텍스트 주위에 선을 그리지만 한쪽만 열려면 어떻게 해야 합니까?

와 비슷한 작업을 하고 싶지만 \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

\documentclass{article}

\begin{document}

\[
\begin{array}{@{}|@{\,}l@{}}
\hline
abc\\
\hline
\end{array}\quad\mbox{or}\quad
\begin{array}{@{}l@{\,}|@{}}
\hline
abc\\
\hline
\end{array}
\]

\end{document}

여기에 이미지 설명을 입력하세요

답변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}

여기에 이미지 설명을 입력하세요

관련 정보