如何制作这种特殊类型的盒子?

如何制作这种特殊类型的盒子?

我需要这种类型的命令。有人能帮帮我吗?我用表格和一些负空间来做到这一点,但这样做非常困难。

在此处输入图片描述 在此处输入图片描述

答案1

我将\newcommand在 Tikz 中创建一个。

编辑:我稍微抬高了线条和文本节点,这样就不会太拥挤。此外,线条恢复了默认粗细(看起来更好)。

现在您可以改变节点和线条的颜色,因此参数是:

  1. 左上角的单词。
  2. 颜色
  3. 较长的文本本身。

我没有写出你在例子中所举的等式,我不知道正确的语法,但我认为这并不重要,因为你的问题是关于特殊框的。

输出

在此处输入图片描述

代码

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{calc,positioning}

\newcommand{\mytab}[3]{
\begin{tikzpicture}
        \node[anchor=text, text=#2] (#1) {\raisebox{1mm}{\textbf{\emph{#1}}}};  
        \node[anchor=text,text width=\textwidth] (sec) {\hphantom{\textbf{\emph{#1}}} \hspace{.2em} #3};
        \draw[draw=#2] (#1.north east|-sec.north) -- ($(#1.south east)+(0,2pt)$) -- ($(#1.south west)+(0,2pt)$) -- 
                    (sec.south west) -- (sec.south east) -- (sec.north east);
\end{tikzpicture}       
}

\begin{document}

    \mytab{a}{green}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed semper dui in tellus hendrerit semper. Aenean in rutrum nulla. Nullam eleifend feugiat neque, sit amet iaculis arcu aliquam id. Vestibulum maximus, risus at condimentum tempus, ipsum nunc suscipit velit, at tempus nisi arcu nec ipsum. Morbi eget tortor in turpis ultricies condimentum. Sed venenatis condimentum feugiat. Integer eget ligula sem. Sed gravida laoreet ultrices. Vivamus tincidunt ac metus nec finibus. Praesent a felis sed enim mollis ornare.}

    \mytab{Text}{blue}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed semper dui in tellus hendrerit semper. Aenean in rutrum nulla. Nullam eleifend feugiat neque, sit amet iaculis arcu aliquam id. Vestibulum maximus, risus at condimentum tempus, ipsum nunc suscipit velit, at tempus nisi arcu nec ipsum. Morbi eget tortor in turpis ultricies condimentum. Sed venenatis condimentum feugiat. Integer eget ligula sem. Sed gravida laoreet ultrices. Vivamus tincidunt ac metus nec finibus. Praesent a felis sed enim mollis ornare.}

    \mytab{Very Long Text}{red}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed semper dui in tellus hendrerit semper. Aenean in rutrum nulla. Nullam eleifend feugiat neque, sit amet iaculis arcu aliquam id. Vestibulum maximus, risus at condimentum tempus, ipsum nunc suscipit velit, at tempus nisi arcu nec ipsum. Morbi eget tortor in turpis ultricies condimentum. Sed venenatis condimentum feugiat. Integer eget ligula sem. Sed gravida laoreet ultrices. Vivamus tincidunt ac metus nec finibus. Praesent a felis sed enim mollis ornare.}

    \mytab{Corollario}{purple}{Sia ($X,T$) spazio topologico.\\
        Equation goes here
    }
\end{document}

相关内容