Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am looking to replicate the look of paragraphs within a tikz environment (actually a minipage).

\documentclass[letterpaper,12pt]{book}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes,backgrounds,arrows}   
\usepackage{tabularx}
\tikzset{mybox/.style= {draw=black,fill=black!5,thick,rectangle,rounded corners,inner xsep=40pt, inner ysep=14pt}}
\begin{document}
\begin{tikzpicture}[transform shape]
\node [mybox] (box) { \begin{minipage}[t!]{0.75\textwidth}
{Then we look for \textbf{clues}. 

Okay, this is a good time to find any direction words. Those are words that tell you how the two blanks are related.

Here's one: ``while.'' The word ``while'' sets up a contrast between the first and second blanks. We know from Step One that both are people who work with stars, and now we also know that they are different kinds of people.     
}
\end{minipage} };
\end{tikzpicture}
\end{document}  

I know I can manually add space with '\vpsace' for instance, but the result is often not pretty.

share|improve this question
1  
And which is the question here? –  Gonzalo Medina Apr 25 '13 at 3:53
    
I think the problem is related to: Why is \parskip zero inside a minipage?. I think you can take it out of tikz and see the same problem in a minipage. –  Peter Grill Apr 25 '13 at 4:05

1 Answer 1

up vote 4 down vote accepted

This issue is not related to tikz but is an issue with minipage.

In a minipage, the parameters \parskip and \parindent seem to be reset.
So you can adapt the solution from How to preserve the same parskip in minipage to define a minipageparskip environment which preserves the \parskip and \parindent. Here is a before (in red) and after comparison:

enter image description here

References:

Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes,backgrounds,arrows}   
\usepackage{tabularx}
\tikzset{mybox/.style= {draw=black,fill=black!5,thick,rectangle,rounded corners,inner xsep=40pt, inner ysep=14pt}}


\newlength{\currentparskip}
\newlength{\currentparindent}
\newenvironment{minipageparskip}[2][]
  {\setlength{\currentparskip}{\parskip}% save the value
    \setlength{\currentparindent}{\parindent}%
   \begin{minipage}[#1]{#2}% open the minipage
   \setlength{\parskip}{\currentparskip}% restore the value
   \setlength{\parindent}{\currentparindent}% restore the value
  }
  {\end{minipage}}

\begin{document}
\begin{tikzpicture}[transform shape]
\node [mybox,fill=red, fill opacity=0.2, text opacity=1] (box) { \begin{minipage}[t!]{0.75\textwidth}
Then we look for \textbf{clues}. 

Okay, this is a good time to find any direction words. Those are words that tell you how the two blanks are related.

Here's one: ``while.'' The word ``while'' sets up a contrast between the first and second blanks. We know from Step One that both are people who work with stars, and now we also know that they are different kinds of people.     
\end{minipage} };
\end{tikzpicture}

\begin{tikzpicture}[transform shape]
\node [mybox] (box) { \begin{minipageparskip}[t!]{0.75\textwidth}
Then we look for \textbf{clues}. 

Okay, this is a good time to find any direction words. Those are words that tell you how the two blanks are related.

Here's one: ``while.'' The word ``while'' sets up a contrast between the first and second blanks. We know from Step One that both are people who work with stars, and now we also know that they are different kinds of people.     
\end{minipageparskip} };
\end{tikzpicture}
\end{document}
share|improve this answer
    
Thank you for the solution. I will be using this for sure. As a side note, would there be any reason why I shouldn't use \smallskip to get a little extra vertical space? I don't remember, but I seemed to have read at some point that the \_skip commands should be avoided. Is this this true? Within this context of course. –  Calhistorian Apr 25 '13 at 17:54
1  
@Calhistorian: You can use \smallskip if you want to have different spacing between individual paragraphs. But if you want all the paragraphs to have that spacing in this special environment you can simply use \setlength{\parskip}{\smallskipamount}. –  Peter Grill Apr 25 '13 at 21:25
    
@Calhistorian: However, before you go and start changing the value of \parskip everywhere you should review Too much whitespace before lists when changing the \parskip length as changing \parindent and \parskip is considered as one of the "deadly sins" in l2tabu and should be avoided. –  Peter Grill Apr 25 '13 at 21:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.