2

This LaTeX source:

\documentclass{article}
\usepackage{tikz}
 \usetikzlibrary{shapes.geometric}

\begin{document}
 \begin{tikzpicture}
  \node[trapezium, draw, trapezium left angle=120, trapezium right angle=90,text width=8cm] (labelTransform) at (0,0) {Very long and interesting description of sometfing. We also add some more text and also symbols like $\tau$, $\phi$ or $\aleph$ to look exceptionaly scientific. Moreover, this way we make the text even longer.};
\end{tikzpicture}
\end{document}

gives this output

enter image description here

Is there possibility to make the node to look like this:

enter image description here

Thanks for help!

EDIT: Thanks to Ivan's response I got actually this code:

\documentclass{article}
\usepackage{tikz}
\usepackage{shapepar}
\usetikzlibrary{shapes}

\begin{document}

\begin{tikzpicture}

\newcommand{\trapeziumParShape}{
{-2}
{0}b{-2}\\ 
{0}t{-2}{19}\\ 
{5}t{2.5}{14.5}\\ 
{5}e{2.5}
}

  \node[trapezium, draw, trapezium left angle=120, trapezium right angle=90] at (0,0) {
  \begin{minipage}{\textwidth}
        \Shapepar{\trapeziumParShape}Very long and interesting description of sometfing. We also add some more text and also symbols like $\tau$, $\phi$ or $\aleph$ to look exceptionaly scientific. Moreover, this way we make the text even longer.
   \end{minipage}
   }; 
\end{tikzpicture}

\end{document}

which produces this:

enter image description here

and no idea how to shift the text inside the node to the proper place.

1
1

SEE LATER FOR SHAPEPAR APPROACH

This is a hack, and therefore not encouraged. What I do is use tabstackengine to set the text (even though I have no tabbing). The downside is that manual line breaks are required here. Thus, the lines will also be ragged.

So what is the hack? I left align the stack (\tabbedCenterstack[l] ) and employ the \TABstackTextstyle feature to apply a macro to each cell (it is not intended to take an argument, but to specify shape, fontsize, etc. for each cell). However, the macro I employ is \traptab that reads two arguments!

It regurgitates them (so nothing is lost), but uses #2 as part of an \hspace argument. This is because I know (having written the package) that the first thing that \TABstackTextstyle will find is a special strut command with an argument corresponding to the row number (the strut is used to set either row baselineskip or gap between rows). Thus, what traptab does is subtract off a space corresponding to the total number of rows minus the current row number (In this example, #2 will vary from 1 to 4, and \TABstack@rows will always be 4).

I set \thetraptab to 8pt, so that the first row gets 24pts left shift, then 16pt for the 2nd row, 8pt for the 3rd row and 0pt for the 4th row.

Yuck! But here it is.

\documentclass{article}
\usepackage{tikz}
\usepackage{tabstackengine}
 \usetikzlibrary{shapes.geometric}
\def\thetraptab{8pt}
\makeatletter
\def\traptab#1#2{#1{#2}\hspace{\numexpr#2-\TABstack@rows\relax
  \dimexpr\thetraptab\relax}}
\makeatother
\TABstackTextstyle{\traptab}
\begin{document}
 \begin{tikzpicture}
  \node[trapezium, draw, trapezium left angle=120, trapezium right angle=90,text width=8cm] (labelTransform) at (0,0) {%
  \tabbedCenterstack[l]{%
  Very long and interesting description of something. We\\% <- MANUAL BREAKS 
  also add some more text and also symbols like $\tau$, $\phi$, or\\ 
  $\aleph$ to look exceptionaly scientific. Moreover, this way\\ 
  we make the text even longer.%
}};
\end{tikzpicture}
\end{document}

enter image description here


*SHAPEPAR

I have no proficiency at shapepar...but,

Using the OP's code, I did several changes: I changed the width of the minipage to 2.8in and I added an \hspace{-24pt} prior to the \Shapepar. I also twiddled the shapepar parameters to achieve a 4 line stack.

\documentclass{article}
\usepackage{tikz}
\usepackage{shapepar}
\usetikzlibrary{shapes}

\begin{document}

\begin{tikzpicture}

\newcommand{\trapeziumParShape}{
{-2}
{0}b{-3}\\ 
{0}t{-3}{18}\\ 
{4}t{0}{15}\\ 
{4}e{0}
}

  \node[trapezium, draw, trapezium left angle=120, trapezium right angle=90] at (0,0) {
  \begin{minipage}{2.8in}
        \hspace{-24pt}%
        \Shapepar{\trapeziumParShape}Very long and interesting description of sometfing. We also add some more text and also symbols like $\tau$, $\phi$ or $\aleph$ to look exceptionaly scientific. Moreover, this way we make the text even longer.
   \end{minipage}
   }; 
\end{tikzpicture}

\end{document}

enter image description here

1
  • Thank you Steven for the shapepar approach! Works well! – nicnajder Apr 22 at 13:32

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.