5

I would like to reduce the left margin inside this node:

\documentclass[a4paper,12pt,twoside]{article}
\usepackage{tikz}
\usepackage{enumerate}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzstyle{block} = [rectangle, draw, text width=11em, text centered, minimum height=4em]
\begin{tikzpicture}[node distance=6cm, auto, >=stealth]
\node[block] (Example) 
{\textbf{Example}
\begin{itemize}
\item First item: string
\item Second item: float
\item Third item: float
\end{itemize}};
\end{tikzpicture}
\end{document}

I'll appreciate a lot any help or advice!

6

The margin isn't introduced by the TikZ node, but by the enumerate environment. You can move your list to the left by adjusting the \leftmargini length, as explained in the answer to Changing left margin in itemize environment of beamer class.

\setlength{\leftmargini}{1.3em} works quite well in this case:

\documentclass[a4paper,12pt,twoside]{article}
\usepackage{tikz}
\usepackage{enumerate}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzset{block/.style={rectangle,
  draw,
  text width=11em,
  text centered,
  minimum height=4em,
  execute at begin node={\setlength{\leftmargini}{1.3em}}
}
}
\begin{tikzpicture}[node distance=6cm, auto, >=stealth]
\node[block] (Example) 
{\textbf{Example}
\begin{itemize}
\item First item: string
\item Second item: float
\item Third item: float
\end{itemize}};
\end{tikzpicture}
\end{document}

TikZ node with itemize environment and reduced left margin

You can automatically execute this command in all of your block nodes by adding the key execute at begin node={\setlength{\leftmargini}{1.3em}} to the style definition.

On a side note, the PGF v 2.1 syntax for defining styles is \tikzset{<style name>/.style={<options>}} (instead of \tikzset{<style name>}=[<options>]).

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.