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 have a diagram in tikz where each node contains an itemized list.

\documentclass[11pt, authoryear, 3p]{elsarticle}

\usepackage{tikz}
\usetikzlibrary{shapes,positioning,arrows}

\begin{document}

\begin{figure}
\tikzstyle{dataset} = [rectangle, draw, text width = 2in, minimum height=1in, ]
\begin{tikzpicture}[auto, font=\scriptsize]
    % Place nodes
    \node [dataset] (tm) {Data 1 \begin{itemize}
            \item{\# Adults } \item{\# Children} \item{Income} 
            \item{Ethnicity}
          \end{itemize}};
    \node [dataset, right of=tm, node distance=3in] (dmv) {Data 2 \begin{itemize} \item{Data 2} \end{itemize}};
    % draw links
    \path [<->] (tm) edge node[above, sloped] {Address} (dmv);
\end{tikzpicture}
    \caption{Analysis dataset assembly.}
    \label{fig:dataset}
\end{figure}


\end{document} 

Output

The items are double-spaced, as the rest of the document. How can I set these nodes to be single-spaced? I have tried encasing the chunk in a singlespaced environment, and related questions (e.g., this one) don't seem to be precisely applicable.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Like this?

\documentclass[11pt, authoryear, 3p]{elsarticle}

\usepackage{tikz,enumitem,setspace,kantlipsum}
\usetikzlibrary{shapes,positioning,arrows}

\begin{document}
\doublespacing
\kant[1]
\begin{figure}[htb]
\tikzset{dataset/.style = {rectangle, draw, text width = 2in, minimum height=1in}}
\begin{tikzpicture}[auto, font={\scriptsize}]
    % Place nodes
    \node [dataset] (tm) {Data 1 
                            \begin{itemize}[itemsep=0pt,partopsep=0pt,topsep=0pt]   %% this added.
                                \item{\# Adults } 
                                \item{\# Children} 
                                \item{Income}
                                \item{Ethnicity}
                            \end{itemize}\par};
    \node [dataset, right of=tm, node distance=3in] (dmv) {Data 2 
                            \begin{itemize}[itemsep=0pt,partopsep=0pt,topsep=0pt] 
                                \item{Data 2} 
                            \end{itemize}\par};
    % draw links
    \path [<->] (tm) edge node[above, sloped] {Address} (dmv);
\end{tikzpicture}
    \caption{Analysis dataset assembly.}
    \label{fig:dataset}
\end{figure}
\kant[2]

\end{document} 

enter image description here

share|improve this answer
    
You've beaten me for a minute. Anyway I think that with topsep=5pt it looks better :-) –  karlkoeller Feb 14 at 15:12
    
@karlkoeller Thanks. :). I agree with topsep. But I want to leave it to the OP to adjust. –  Harish Kumar Feb 14 at 15:17

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.