3

I need this type of command. Someone can help me? I do this with tabular and some negative space but it is very difficult to work like this.

enter image description here enter image description here

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Furthermore, it would be a good idea to provide a minimal working example (MWE), containing what you have done so far and how you have achieved what is mentioned in the question. Furthermore, it might be important to know if this box is going to contain only corollaries (i.e., math) or there will be text as well. – Pouya May 15 '15 at 14:04
  • Andrea, do you just need to input text in it or also equations/graphs? – Alenanno May 15 '15 at 14:22
8

I would create a \newcommand in Tikz.

Edit: I raised the line and the text node a bit so it's not too crowded. Also, the line is back to the default thickness (better looking).

Now you can change the colour of the node and the line, so the arguments are:

  1. The word that goes in the top-left corner.
  2. Colour
  3. The longer text itself.

I didn't manage to write the equation you have in your example, I don't know the proper syntax, but I thought it was not critical since your question was about the special box.

Output

enter image description here

Code

\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}
  • You are a Genius man! I have the last trouble.. I need to put the first argument in normal font with \emph{ \textbf{ } } and be able to decide his colour i.e. \colour{ \emph{ \textbf{ } } } and at last to change his vertical position with \raisebox{.07cm } { } and so ... raisebox{.07cm } { \colour{ \emph{ \textbf{ } } } } in few words i need to personalise your PERFECT command with my own style used in the example! Thank you! – Andrea Leo May 15 '15 at 19:08
  • @AndreaLeo Color both text and the line? – Alenanno May 15 '15 at 19:46
  • Yes the text in the first arg. For what concerns the line I understand how to change color @Aleanno – Andrea Leo May 15 '15 at 19:55
  • @AndreaLeo See changes. You can change both with one command. – Alenanno May 15 '15 at 20:02
  • Yeah! That's it! I love you <3 – Andrea Leo May 15 '15 at 20:06

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.