3

This question already has an answer here:

This code create the table printed below:

\documentclass[a4paper,11pt]{article}

\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}

\begin{document}

% outline different types table
\begin{table}
  \centering
  \footnotesize
  \begin{tabularx}{\linewidth}{lXl}
    \toprule
    Type & Example & Reference \\
    \midrule
    Habitat & Three tree-climbing species used different parts of trees & \textcite{LaraEtAl2015} \\
    Diet & Three species of dabbling ducks \textit{Anas} foraged on seeds of different size and mass & \textcite{BrochetEtAl2012} \\
    Temporal & Different species of \textit{Gyps} vulture visited carcasses at different times of day & \textcite{Kendall2014} \\
    Spatial & Different species of \textit{Sterna} tern foraged in different parts of the sea & \textcite{RobertsonEtAl2014} \\
    Acoustic & A large community of vocalising rainforest species partitioned the sound environment & \textcite{Luther2009} \\
    \bottomrule
  \end{tabularx}
  \caption[Types of niche partitioning]{Different types of niche partitioning with examples. Note that these types of niche partitioning are not mutually exclusive. For example, two species could partition habitat, which might be a consequence of partitioning diet.}.
  \label{table_niche_partitioning}
\end{table}
%%nichepartitioning

\end{document}

![enter image description here]1

When a line spills over onto the next line, how can I have the line indented, like this:

![enter image description here]2

marked as duplicate by Werner tables Aug 10 '15 at 20:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

Insert a paragraph \hangindent for the X-column:

enter image description here

\documentclass{article}

\usepackage{booktabs,tabularx}

\newcommand{\textcite}[1]{#1}% Just for this example
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{l>{\hangindent=2em}Xl}
  \toprule
  Type & Example & Reference \\
  \midrule
  Habitat & Three tree-climbing species used different parts of trees & \textcite{LaraEtAl2015} \\
  Diet & Three species of dabbling ducks \textit{Anas} foraged on seeds of different size and mass & \textcite{BrochetEtAl2012} \\
  Temporal & Different species of \textit{Gyps} vulture visited carcasses at different times of day & \textcite{Kendall2014} \\
  Spatial & Different species of \textit{Sterna} tern foraged in different parts of the sea & \textcite{RobertsonEtAl2014} \\
  Acoustic & A large community of vocalising rainforest species partitioned the sound environment & \textcite{Luther2009} \\
  \bottomrule
\end{tabularx}

\end{document}
  • how can I use \hangindent for the X column when this is my code: \begin{tabularx}{\linewidth}{Xl}? Note Xl instead of lXl – luciano Aug 11 '15 at 9:19
  • @luciano: Use \begin{tabularx}{>{\hangindent=1em}Xl}... – Werner Aug 11 '15 at 17:54
  • thanks but that code is throwing an error. Do you know why? – luciano Aug 12 '15 at 16:17
  • 2
    @luciano: Sorry, that should have been \begin{tabularx}{\linewidth}{>{\hangindent=1em}Xl} I forgot that tabularx requires a length specification before the table preamble/column specification. – Werner Aug 12 '15 at 16:27

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