How can I have a table like the following picture in latex?
[Tex/LaTex] Creating a special table with different row lengths in latex
tablestabularx
Related Solutions
The idea is to use some of the commands provided by the table
option of the xcolor package. The first option would be to use \rowcolor
to specify the desired color for the whole row; however, since you need to use \multicolumn
to override the default column specification (in order to have centered contents in some cells),the effect of \rowcolor
will be lost, so it's better to use \cellcolor
inside \multicolumn
for the modified cells. The color for the text can be changed using the \textcolor
(from the color
package) command. These ideas can be better implemented through a new command. To get the fine double line, I used a \fbox
(locally changing \fboxsep
) to place a frame around the table, and a "fake" row; feel free to change the length according to your needs:
\documentclass{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\newcommand\BlackCell[1]{%
\multicolumn{1}{c|}{\cellcolor{black}\textcolor{white}{#1}}
}
\begin{document}
\begingroup
\noindent
\setlength\fboxsep{0.6pt}\fbox{%
\begin{tabularx}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}{| l | X | l | l | }
\hline
\BlackCell{} & \BlackCell{Research on Human Embryo/Foetus} & \BlackCell{YES} & \BlackCell{Page} \\\hline\multicolumn{4}{c}{}\\[-11.5pt]\hline
& Does the proposed research involve processing of genetic information or personal data (e.g. health, sexual lifestyle, ethnicity, political opinion, religious or philosophical conviction)? & & \\
\hline
& Does the proposed research involve tracking the location or observation of people? & & \\
\hline
& I CONFIRM THAT NONE OF THE ABOVE ISSUES APPLY TO MY PROPOSAL & YES & \\
\hline
\end{tabularx}%
}
\endgroup
\end{document}
An classic LaTeX approach, considering @Alenanno comments and own experiences in table coding ...
With slightly reformatted second column head table can be fit in standard (portrait) paper orientation:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,
makecell, % <-- new
multirow,
tabularx} % <-- new
\renewcommand\theadfont{\bfseries\small}
\usepackage{siunitx} % <-- new
\usepackage[margin=20mm,showframe]{geometry}% <-- added only to show page layout
\begin{document}
\begin{table}
\setlength\tabcolsep{4pt}
\begin{tabularx}{\textwidth}{@{}l X c *{3}{S[table-format=2.1]}@{}}
\toprule
\thead[b]{Admission requirements \\ for Mathematics (MSc)}
& \thead[bl]{Courses completed/\\ to be completed \\ before study start}
& \thead[b]{Date of \\ completion}
& {\thead[b]{Credits$^*$}}
& {\thead[b]{ECTS}}
& {\thead[b]{ECTS \\ in all}} \\
\midrule
Mathematical Analysis (30 ECTS)
& Mathematical Analysis 1 & 22.04.2014 & 5 & 7.5 & \multirowcell{3}{34.5} \\
& Mathematical Analysis 2 & 15.02.2013 & 8 & 12 & \\
& Complex Analysis & 01.07.2015 & 10 & 15 & \\ \midrule
Algebra/Linear algebra (22.5 ECTS)
& Advanced Algebra & 17.02.2013 & 6 & 9 & \multirowcell{2}{22.5} \\
& Abstract Algebra & 01.06.2015 & 9 & 13.5 & \\
\midrule
Geometry/Topology (15 ECTS)
& Topology & 01.11.2014 & 7 & 10.5 & \multirowcell{3}{18} \\
& Vector Analysis & 15.06.2015 & 3 & 4.5 & \\
& Differential Geometry & 15.02.2013 & 2 & 3 & \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
Of course it also can be landscape orientation with bigger fonts, for example with memoir
package:
In this case the MWE preamble is:
\documentclass[14pt,landscape]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,
makecell, % <-- new
multirow,
tabularx} % <-- new
\renewcommand\theadfont{\bfseries\small}
\usepackage{siunitx} % <-- new
\usepackage[margin=30mm,showframe]{geometry}% <-- added only to show page
Best Answer
A possible solution. I suggest not using the vertical lines, but rather the
booktabs
package. For horizontal alignment of20
you can exploit themultirow
package, while for vertically alignment you can compute the width of the largest entry of the first columns via thecalc
package.