5

Expected output (2nd line has 5mm more indent than 1st, 3rd and following lines have 5mm more indent than 2nd):

\documentclass{article}
\begin{document}
  \setlength{\parindent}{0pt}
  \parshape=3 5mm 40mm 10mm 35mm 15mm 30mm
  This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4. This is sentence 5.
\end{document}

Bad output (tikz):

\documentclass{article}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \path node[draw,text width=50mm]
      { \setlength{\parindent}{0pt}
        \parshape=3 5mm 40mm 10mm 35mm 15mm 30mm
        This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4. This is sentence 5.
      };
  \end{tikzpicture}
\end{document}

7

Just introduce \par command will solve the issue:

\documentclass{article}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \path node[draw,text width=50mm]
      { \setlength{\parindent}{0pt}
        \parshape=3 5mm 40mm 10mm 35mm 15mm 30mm
        This is sentence 1. This is sentence 2. This is sentence 3.
        This is sentence 4. This is sentence 5.\par
      };
  \end{tikzpicture}
\end{document}
  • 3
    I think you need a trailing % following \setlength{}{}. – Peter Grill May 21 at 6:53
  • @PeterGrill I have followed the tag what the user provided as MWE...anyhow, thanks... – MadyYuvi May 21 at 6:55
8

Put the text in a \parbox:

enter image description here

Also it appears that you can use the font= to set the \parshape and then it just works (although I am not sure that this is a good idea).

Code:

\documentclass{article}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \path node[draw,text width=50mm]
          {\parbox{\linewidth}{%
              \setlength{\parindent}{0pt}
                \parshape=3 5mm 40mm 10mm 35mm 15mm 30mm
                This is sentence 1. 
                This is sentence 2. 
                This is sentence 3. 
                This is sentence 4. 
                This is sentence 5.%
          }%
      };
  \end{tikzpicture}
\end{document}

Code:

\begin{document}
  \begin{tikzpicture}
    \path node[draw,text width=50mm, font={\parshape=3 5mm 40mm 10mm 35mm 15mm 30mm}]
       {%
            This is sentence 1. 
            This is sentence 2. 
            This is sentence 3. 
            This is sentence 4. 
            This is sentence 5.%
      };
  \end{tikzpicture}
\end{document}

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.