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 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!

share|improve this question
add comment

1 Answer

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>]).

share|improve this answer
add comment

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.