0

How can I center the numbers (and the rest of the columns of the table) and separate the columns from each other? Plus I would like to put Tas2r40p and Tas2r9p underneath Tas2r40 and Tas2r9, respectively.

\usepackage{longtable, array, booktabs}
\usepackage{rotating}
\usepackage{pdflscape}

    \begin{landscape}
\setlength{\tabcolsep}{2.5pt} 
\small\sffamily
\setlength{\extrarowheight}{1pt}
\begin{longtable}{lllllll}

\caption{List of species we intend to use in this work and its corresponding habitats and migration habits}\\

\toprule
\bfseries Species & \bfseries Family & \bfseries Order & \bfseries Tas2r40
(Tas2r40p) & \bfseries Tasr9 (Tas2r9p) & \bfseries Habitat & \bfseries Migration \\
\midrule
\endfirsthead

\toprule
\bfseries Species & \bfseries Family & \bfseries Order & \bfseries Tas2r40
(Tas2r40p) & \bfseries Tasr9 (Tas2r9p) & \bfseries Habitat & \bfseries Migration \\ 
\midrule
\endhead

\midrule
\endfoot

\bottomrule
\endlastfoot

\textit{Acanthisitta chloris} & Acanthisittidae & Passeriformes & 2     & 4     & Land birds & Non-migratory \\
\textit{Acrocephalus arundinaceus} & Sylviidae & Passeriformes & 2     & 3     & Water birds & Migratory \\
\textit{Aegithalos caudatus} & Aegithalidae & Passeriformes & 2     & 2     &  Intermediate regions & Non-migratory \\
\textit{Agelaius phoeniceus} & Icteridae & Passeriformes &       & 3     & Water birds & Migratory \\
\textit{Alaudala cheleensis} & Alaudidae & Passeriformes & 3     & 1     & Water birds & Partially Migratory \\
\textit{Alca torda} & Alcidae & Charadriiformes & (1)    & 1     & Water birds & Migratory \\
\textit{Aleadryas rufinucha} & Pachycephalidae & Passeriformes & 1     & 2     & Land birds & Non-migratory \\
\textit{Alectura lathami} & Megapodiidae & Galliformes & 1     &       & Land birds & Non-migratory \\
\textit{Anas platyrhynchos} & Anatidae & Anseriformes & 1     & 2     & Water birds & Partially Migratory \\
\textit{Anhinga anhinga} & Anhingidae & Suliformes &       & 1     & Water birds & Non-migratory \\
\textit{Anser cygnoides} & Anatidae & Anseriformes & 1     & 1     & Water birds & Migratory \\
\textit{Anseranas semipalmata} & Anseranatidae & Anseriformes &       & 1     & Water birds & Partially Migratory \\
\textit{Anthoscopus minutus} & Remizidae & Passeriformes & 1     & 2     & Water birds & Non-migratory \\
\textit{Antrostomus carolinensis} & Caprimulgidae & Caprimulgiformes & 1     & 1     &  Intermediate regions & Migratory \\
\textit{Aphelocoma coerulescens} & Corvidae & Passeriformes & 2     & 3     &  Intermediate regions & Non-migratory \\
\textit{Aptenodytes forsteri} & Spheniscidae & Sphenisciformes & 1     &       & Water birds & Partially Migratory \\
\textit{Apteryx australis} & Apterygidae & Struthioniformes & (1)    & 1     & Land birds & Non-migratory \\
\textit{Arenaria interpres} & Scolopacidae & Charadriiformes & 1     &       & Water birds & Migratory \\
\textit{Asarcornis scutulata} & Anatidae & Anseriformes & 1     & 1     & Water birds & Non-migratory \\
\textit{Atrichornis clamosus} & Atrichornithidae & Passeriformes &       & 3     &  Intermediate regions & Non-migratory \\
\textit{Balaeniceps rex} & Balaenicipitidae & Pelecaniformes &       & 1     & Water birds & Non-migratory \\
\textit{Bombycilla garrulus} & Bombycillidae & Passeriformes & 1     & 2     & Land birds & Migratory \\
\textit{Brachypodius atriceps} & Pycnonotidae & Passeriformes & 1     & 4     & Land birds & Non-migratory \\
\textit{Bucco capensis} & Bucconidae & Piciformes &       & 4     & Land birds & Non-migratory \\
\textit{Buphagus erythrorhynchus} & Sturnidae & Passeriformes & 1     &       & Water birds & Non-migratory \\
\textit{Burhinus bistriatus} & Burhinidae & Charadriiformes & 1     & 1     & Water birds & Non-migratory \\
\textit{Cairina moschata} & Anatidae & Anseriformes & 1     & 2     & Water birds & Non-migratory \\
\textit{Calcarius ornatus} & Emberizidae & Passeriformes &       & 4     & Water birds & Migratory \\
\textit{Calidris pugnax} & Scolopacidae & Charadriiformes & 1     & 1     & Water birds & Migratory \\
\textit{Callaeas wilsoni} & Callaeatidae & Passeriformes & 2     & 5     & Land birds & Non-migratory \\
\textit{Callipepla squamata} & Odontophoridae & Galliformes &       & 6     & Water birds & Non-migratory \\
\textit{Calonectris borealis} & Procellariidae & Procellariiformes &       & 1     & Water birds & Migratory \\
\textit{Calypte anna} & Trochilidae & Caprimulgiformes &       & 1     &  Intermediate regions & Partially Migratory \\
\textit{Calyptomena viridis} & Eurylaimidae & Passeriformes &       & 6     & Land birds & Non-migratory \\
\textit{Campylorhamphus procurvoides} & Dendrocolaptidae & Passeriformes & 1     & 1     & Land birds & Non-migratory \\
\textit{Cardinalis cardinalis} & Cardinalidae & Passeriformes & 1     & 4     &  Intermediate regions & Non-migratory \\
\textit{Casuarius casuarius} & Casuariidae & Struthioniformes & 1     & 1     & Land birds & Non-migratory \\
\textit{Catharus fuscescens} & Turdidae & Passeriformes & 1     & 1     & Land birds & Migratory \\
\textit{Cepphus grylle} & Alcidae & Charadriiformes & 1     & 1     & Water birds & Migratory \\
\textit{Cercotrichas coryphoeus} & Muscicapidae & Passeriformes & 1     & 3     &  Intermediate regions & Non-migratory \\
\textit{Certhia brachydactyla} & Certhiidae & Passeriformes &       & 2     & Land birds & Non-migratory \\
\textit{Cettia cetti} & Sylviidae & Passeriformes &       & 4     &  Intermediate regions & Non-migratory \\
\textit{Chaetops frenatus} & Turdidae & Passeriformes & 3     & 3     & Water birds & Non-migratory \\
\textit{Chaetorhynchus papuensis} & Dicruridae & Passeriformes &       & 4     & Land birds & Non-migratory \\
\textit{Chaetura pelagica} & Apodidae & Caprimulgiformes &       & 4     & Land birds & Migratory \\

\end{longtable}
\end{landscape}

1 Answer 1

1

Here is a solution, with some simplifications of the code and an improved layout (from my point of view). The two-line column head can be obtained with the \thead command from makecell. I added some spacing in your table to group rows with the same first letter in the first column:

\documentclass{article}
\usepackage{lmodern} 
\usepackage{longtable, array, booktabs, makecell}
\renewcommand{\theadfont}{\small\upshape\bfseries}
\usepackage{rotating}
\usepackage{pdflscape}


\begin{document}

\begin{landscape}
\setlength{\tabcolsep}{4pt}
\small\sffamily
\setlength{\extrarowheight}{2pt}
\begin{longtable}{@{}>{\slshape}lllccll@{}}

\caption{List of species we intend to use in this work and its corresponding habitats and migration habits}\\

\toprule
\thead[l]{Species} & \bfseries Family & \bfseries Order & \thead{Tas2r40\\ (Tas2r40p)} & \thead{Tasr9\\ (Tas2r9p)} & \bfseries Habitat & \bfseries Migration \\
\midrule
\endfirsthead

\toprule
\thead[l]{Species} & \bfseries Family & \bfseries Order & \thead{Tas2r40\\ (Tas2r40p)} & \thead{Tasr9\\(Tas2r9p)} & \bfseries Habitat & \bfseries Migration \\
\midrule
\endhead

\midrule
\endfoot

\bottomrule
\endlastfoot

{Acanthisitta chloris} & Acanthisittidae & Passeriformes & 2 & 4 & Land birds & Non-migratory \\
Acrocephalus arundinaceus & Sylviidae & Passeriformes & 2 & 3 & Water birds & Migratory \\
Aegithalos caudatus & Aegithalidae & Passeriformes & 2 & 2 & Intermediate regions & Non-migratory \\
Agelaius phoeniceus & Icteridae & Passeriformes & & 3 & Water birds & Migratory \\
Alaudala cheleensis & Alaudidae & Passeriformes & 3 & 1 & Water birds & Partially Migratory \\
Alca torda & Alcidae & Charadriiformes & (1) & 1 & Water birds & Migratory \\
Aleadryas rufinucha & Pachycephalidae & Passeriformes & 1 & 2 & Land birds & Non-migratory \\
Alectura lathami & Megapodiidae & Galliformes & 1 & & Land birds & Non-migratory \\
Anas platyrhynchos & Anatidae & Anseriformes & 1 & 2 & Water birds & Partially Migratory \\
Anhinga anhinga & Anhingidae & Suliformes & & 1 & Water birds & Non-migratory \\
Anser cygnoides & Anatidae & Anseriformes & 1 & 1 & Water birds & Migratory \\
Anseranas semipalmata & Anseranatidae & Anseriformes & & 1 & Water birds & Partially Migratory \\
Anthoscopus minutus & Remizidae & Passeriformes & 1 & 2 & Water birds & Non-migratory \\
Antrostomus carolinensis & Caprimulgidae & Caprimulgiformes & 1 & 1 & Intermediate regions & Migratory \\
Aphelocoma coerulescens & Corvidae & Passeriformes & 2 & 3 & Intermediate regions & Non-migratory \\
Aptenodytes forsteri & Spheniscidae & Sphenisciformes & 1 & & Water birds & Partially Migratory \\
Apteryx australis & Apterygidae & Struthioniformes & (1) & 1 & Land birds & Non-migratory \\
Arenaria interpres & Scolopacidae & Charadriiformes & 1 & & Water birds & Migratory \\
Asarcornis scutulata & Anatidae & Anseriformes & 1 & 1 & Water birds & Non-migratory \\
Atrichornis clamosus & Atrichornithidae & Passeriformes & & 3 & Intermediate regions & Non-migratory \\ \addlinespace
Balaeniceps rex & Balaenicipitidae & Pelecaniformes & & 1 & Water birds & Non-migratory \\
Bombycilla garrulus & Bombycillidae & Passeriformes & 1 & 2 & Land birds & Migratory \\
Brachypodius atriceps & Pycnonotidae & Passeriformes & 1 & 4 & Land birds & Non-migratory \\
Bucco capensis & Bucconidae & Piciformes & & 4 & Land birds & Non-migratory \\
Buphagus erythrorhynchus & Sturnidae & Passeriformes & 1 & & Water birds & Non-migratory \\
Burhinus bistriatus & Burhinidae & Charadriiformes & 1 & 1 & Water birds & Non-migratory \\ \addlinespace
Cairina moschata & Anatidae & Anseriformes & 1 & 2 & Water birds & Non-migratory \\
Calcarius ornatus & Emberizidae & Passeriformes & & 4 & Water birds & Migratory \\
Calidris pugnax & Scolopacidae & Charadriiformes & 1 & 1 & Water birds & Migratory \\
Callaeas wilsoni & Callaeatidae & Passeriformes & 2 & 5 & Land birds & Non-migratory \\
Callipepla squamata & Odontophoridae & Galliformes & & 6 & Water birds & Non-migratory \\
Calonectris borealis & Procellariidae & Procellariiformes & & 1 & Water birds & Migratory \\
Calypte anna & Trochilidae & Caprimulgiformes & & 1 & Intermediate regions & Partially Migratory \\
Calyptomena viridis & Eurylaimidae & Passeriformes & & 6 & Land birds & Non-migratory \\
Campylorhamphus procurvoides & Dendrocolaptidae & Passeriformes & 1 & 1 & Land birds & Non-migratory \\
Cardinalis cardinalis & Cardinalidae & Passeriformes & 1 & 4 & Intermediate regions & Non-migratory \\
Casuarius casuarius & Casuariidae & Struthioniformes & 1 & 1 & Land birds & Non-migratory \\
Catharus fuscescens & Turdidae & Passeriformes & 1 & 1 & Land birds & Migratory \\
Cepphus grylle & Alcidae & Charadriiformes & 1 & 1 & Water birds & Migratory \\
Cercotrichas coryphoeus & Muscicapidae & Passeriformes & 1 & 3 & Intermediate regions & Non-migratory \\
Certhia brachydactyla & Certhiidae & Passeriformes & & 2 & Land birds & Non-migratory \\
Cettia cetti & Sylviidae & Passeriformes & & 4 & Intermediate regions & Non-migratory \\
Chaetops frenatus & Turdidae & Passeriformes & 3 & 3 & Water birds & Non-migratory \\
Chaetorhynchus papuensis & Dicruridae & Passeriformes & & 4 & Land birds & Non-migratory \\
Chaetura pelagica & Apodidae & Caprimulgiformes & & 4 & Land birds & Migratory 
\end{longtable}
\end{landscape}

\end{document} 

enter image description here

5
  • Thank you, this is much better than my version. Is there some way to center only the headers? Plus I need the first column to be all in italic but not the header, do you know how I could do that? Oct 27, 2020 at 15:43
  • In the command \thead[l]{...}, remove the optional [l] to have the default (centred both vertically and horizontally). I thought you wanted everything left-aligned, including the headers.
    – Bernard
    Oct 27, 2020 at 15:43
  • Thank you very much! I just can't figure out what's making the heading Species be italicized Oct 27, 2020 at 16:00
  • That's because \thead inherited the column font shape. Just add \upshape to the redefinition of the head font, like this: \renewcommand{\theadfont}{\small\upshape\bfseries}.
    – Bernard
    Oct 27, 2020 at 16:46
  • Thank you very much! Oct 27, 2020 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .