Here is one way of doing it:
- Use
p{<width>}
for all columns in a regular tabular
.
- To do this, create a new length
\tabularlength
and set it to the total width of the tabular. I've used .975\linewidth
here.
- Then define each of the columns in terms of
\tabularlength
e.g. p{.1\tabularlength}
.
- To get the first column to behave, dispense with
multicolumn
so that the lines can be broken.
- This means we want hyphenation so load
babel
.
- This isn't quite enough as this doesn't allow hyphenation of the first word in the column. So hyphenate these words by hand using
\-
.
- Use
geometry
to get the page layout right.
- Use
>{\bfseries}
for the first column to avoid having to specify bold on every line.
- We still need one
\multicolumn
for the very first line so we don't get spurious vertical rules.
- Use
\centering
rather than the environment center
since the latter adds additional spacing which we don't want here.
This actually fits with (a little) room to spare. If the table were bigger, you could consider using \small
within the table
environment to set the fontsize a little smaller. Or you could adjust the margins etc. using geometry
. It is possible to do this for the whole document or, if necessary, a single page.
The code
\documentclass[a4paper,10pt,british]{article}
\usepackage{babel,geometry}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\begin{document}
\begin{table}
\newlength{\tabularlength}
\setlength{\tabularlength}{.975\linewidth}
\centering
\begin{tabular}{|>{\bfseries}p{.1\tabularlength}|*{3}{p{.3\tabularlength}}}
\cline{2-4}
\multicolumn{1}{l}{} & \textbf{Hibernate OGM} & \textbf{EclipseLink NoSQL} & \textbf{DataNucleus}\\\hline
Goal & Complement JPA with NoSQL, key-value stores & Integrates in the father project main goal of providing a complete persistence solution & Being a standards compliant and efficient JPA and JDO platform\\\hline
NoSQL and Datastores supported & Infinispan, EHCache, MongoDB & MongoDB, Oracle NoSQL, Oracle AQ, JMS, XML files & Google Big Table, MongoDB, Cassandra, Excel, OOXML, ODF, XML, HBase, AppEngine/DataStore, Neo4j, JSON, Amazon S3, GoogleStorage, LDAP, NeoDatis, db4o\\\hline
Oper\-ations supported & Object Oriented queries (JP-QL), CRUD of entities, Polymorphic entities, Embeddable objects, Basic types (partial), Unidirectional and Bidirectional relationships (partial), Collections, Hibernate Search queries, JPA and Hibernate ORM API & Object Oriented Queries, Polymorphic entities, Basic types, Unidirectional relationships, Collections, JPA (partial), Complex hierarchical, Indexed hierarchical data, Mapped hierarchical data, CRUD operations, Embedded objects and collections, Inheritance, Subset of JP-QL and Criteria API, Denormalization & CRUD operations, Embedded objects and collections, Inheritance, Relationships (Unidirectional and Bidirectional), Queries for JP-QL, JDOQL and SQL (partial), Basic types, Joins.\\\hline
No support for & Denormalization, Complex joins and aggregations & Joins & Aggregations? (not specified in documentation)\\\hline
Future & High performance sequence generator, parallel key fetching, support for Map/Reduce, more NoSQL classes, better mixing of NoSQL and RDBMS & ? & JPA2.1 full feature list, Official support for Cassandra, Considering a plugin for REDIS\\\hline
Com\-mer\-cial support & Red Hat & Oracle (via TopLink) & Supported by DataNucleus team\\\hline
Docu\-ment\-ation & Scattered, inactive forums, official documentation lacking & Bureaucratic forums, information is complete and gathered mainly in the official website & Active forums, acceptable official documentation, but the big advantage comes from user support in form of blogs and posts scattered around the Internet\\\hline
\end{tabular}
\end{table}
\end{document}
The output
An alternative layout
I think you might also want to consider including the tabular in landscape orientation as this might make it easier for people to digest. For example:
I used an additional formatting directive for the first column in this case, \raggedright
, to make it look reasonable.
Code for landscape tabular
\documentclass[a4paper,10pt,british]{article}
\usepackage{babel,geometry}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{table}
\newlength{\tabularlength}
\setlength{\tabularlength}{.975\linewidth}
\centering
\begin{tabular}{|>{\bfseries\raggedright}p{.1\tabularlength}|*{3}{p{.3\tabularlength}}}
\cline{2-4}
\multicolumn{1}{l}{} & \textbf{Hibernate OGM} & \textbf{EclipseLink NoSQL} & \textbf{DataNucleus}\\\hline
Goal & Complement JPA with NoSQL, key-value stores & Integrates in the father project main goal of providing a complete persistence solution & Being a standards compliant and efficient JPA and JDO platform\\\hline
NoSQL and Datastores supported & Infinispan, EHCache, MongoDB & MongoDB, Oracle NoSQL, Oracle AQ, JMS, XML files & Google Big Table, MongoDB, Cassandra, Excel, OOXML, ODF, XML, HBase, AppEngine/DataStore, Neo4j, JSON, Amazon S3, GoogleStorage, LDAP, NeoDatis, db4o\\\hline
Oper\-ations supported & Object Oriented queries (JP-QL), CRUD of entities, Polymorphic entities, Embeddable objects, Basic types (partial), Unidirectional and Bidirectional relationships (partial), Collections, Hibernate Search queries, JPA and Hibernate ORM API & Object Oriented Queries, Polymorphic entities, Basic types, Unidirectional relationships, Collections, JPA (partial), Complex hierarchical, Indexed hierarchical data, Mapped hierarchical data, CRUD operations, Embedded objects and collections, Inheritance, Subset of JP-QL and Criteria API, Denormalization & CRUD operations, Embedded objects and collections, Inheritance, Relationships (Unidirectional and Bidirectional), Queries for JP-QL, JDOQL and SQL (partial), Basic types, Joins.\\\hline
No support for & Denormalization, Complex joins and aggregations & Joins & Aggregations? (not specified in documentation)\\\hline
Future & High performance sequence generator, parallel key fetching, support for Map/Reduce, more NoSQL classes, better mixing of NoSQL and RDBMS & ? & JPA2.1 full feature list, Official support for Cassandra, Considering a plugin for REDIS\\\hline
Com\-mer\-cial support & Red Hat & Oracle (via TopLink) & Supported by DataNucleus team\\\hline
Docu\-ment\-ation & Scattered, inactive forums, official documentation lacking & Bureaucratic forums, information is complete and gathered mainly in the official website & Active forums, acceptable official documentation, but the big advantage comes from user support in form of blogs and posts scattered around the Internet\\\hline
\end{tabular}
\end{table}
\end{landscape}
\end{document}
Centred columns & vertical rules
As noted by Flame_Phoenix in the comments, m{<width>}
gives a column of specified width which is centred vertically. This specifier requires the array
package.
Adding a vertical rule before 'Hibernate OGM' is just a question of adjusting the \multicolumn
for the first entry of the tabular. Centring all cells horizontally, as well as vertically, can be done by adding >{\centering}
in the tabular configuration. However, this gets a bit tedious and is harder to adjust consistently. A better solution uses the ability of array
to define a new column type.
\newcolumntype{M}{>{\centering}m{.3\tabularlength}}
Because my example shows the layout for both portrait and landscape, I also need to pull the addition of \tabularlength
out of the tabular
environments so I'm not trying to define an already defined length.
\newlength{\tabularlength}
The m
column type treats \\
as a new line within the column rather than the end of the row. I therefore need to replace \\\hline
with \tabularnewline\hline
.
Finally, I've added a vertical rule on the far right for neatness.
The code
\documentclass[a4paper,10pt,british]{article}
\usepackage{babel,geometry}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{pdflscape}
\newlength{\tabularlength}
\newcolumntype{M}{>{\centering}m{.3\tabularlength}}
\begin{document}
\begin{table}
\setlength{\tabularlength}{.975\linewidth}
\centering
\begin{tabular}{|>{\centering\bfseries}m{.1\tabularlength}|*{3}{M}|}
\cline{2-4}
\multicolumn{1}{l|}{} & \textbf{Hibernate OGM} & \textbf{EclipseLink NoSQL} & \textbf{DataNucleus}\tabularnewline\hline
Goal & Complement JPA with NoSQL, key-value stores & Integrates in the father project main goal of providing a complete persistence solution & Being a standards compliant and efficient JPA and JDO platform\tabularnewline\hline
NoSQL and Datastores supported & Infinispan, EHCache, MongoDB & MongoDB, Oracle NoSQL, Oracle AQ, JMS, XML files & Google Big Table, MongoDB, Cassandra, Excel, OOXML, ODF, XML, HBase, AppEngine/DataStore, Neo4j, JSON, Amazon S3, GoogleStorage, LDAP, NeoDatis, db4o\tabularnewline\hline
Oper\-ations supported & Object Oriented queries (JP-QL), CRUD of entities, Polymorphic entities, Embeddable objects, Basic types (partial), Unidirectional and Bidirectional relationships (partial), Collections, Hibernate Search queries, JPA and Hibernate ORM API & Object Oriented Queries, Polymorphic entities, Basic types, Unidirectional relationships, Collections, JPA (partial), Complex hierarchical, Indexed hierarchical data, Mapped hierarchical data, CRUD operations, Embedded objects and collections, Inheritance, Subset of JP-QL and Criteria API, Denormalization & CRUD operations, Embedded objects and collections, Inheritance, Relationships (Unidirectional and Bidirectional), Queries for JP-QL, JDOQL and SQL (partial), Basic types, Joins.\tabularnewline\hline
No support for & Denormalization, Complex joins and aggregations & Joins & Aggregations? (not specified in documentation)\tabularnewline\hline
Future & High performance sequence generator, parallel key fetching, support for Map/Reduce, more NoSQL classes, better mixing of NoSQL and RDBMS & ? & JPA2.1 full feature list, Official support for Cassandra, Considering a plugin for REDIS\tabularnewline\hline
Com\-mer\-cial support & Red Hat & Oracle (via TopLink) & Supported by DataNucleus team\tabularnewline\hline
Docu\-ment\-ation & Scattered, inactive forums, official documentation lacking & Bureaucratic forums, information is complete and gathered mainly in the official website & Active forums, acceptable official documentation, but the big advantage comes from user support in form of blogs and posts scattered around the Internet\tabularnewline\hline
\end{tabular}
\end{table}
\begin{landscape}
\begin{table}
\setlength{\tabularlength}{.975\linewidth}
\centering
\begin{tabular}{|>{\bfseries\centering}m{.1\tabularlength}|*{3}{M}|}
\cline{2-4}
\multicolumn{1}{l|}{} & \textbf{Hibernate OGM} & \textbf{EclipseLink NoSQL} & \textbf{DataNucleus}\tabularnewline\hline
Goal & Complement JPA with NoSQL, key-value stores & Integrates in the father project main goal of providing a complete persistence solution & Being a standards compliant and efficient JPA and JDO platform\tabularnewline\hline
NoSQL and Datastores supported & Infinispan, EHCache, MongoDB & MongoDB, Oracle NoSQL, Oracle AQ, JMS, XML files & Google Big Table, MongoDB, Cassandra, Excel, OOXML, ODF, XML, HBase, AppEngine/DataStore, Neo4j, JSON, Amazon S3, GoogleStorage, LDAP, NeoDatis, db4o\tabularnewline\hline
Operations supported & Object Oriented queries (JP-QL), CRUD of entities, Polymorphic entities, Embeddable objects, Basic types (partial), Unidirectional and Bidirectional relationships (partial), Collections, Hibernate Search queries, JPA and Hibernate ORM API & Object Oriented Queries, Polymorphic entities, Basic types, Unidirectional relationships, Collections, JPA (partial), Complex hierarchical, Indexed hierarchical data, Mapped hierarchical data, CRUD operations, Embedded objects and collections, Inheritance, Subset of JP-QL and Criteria API, Denormalization & CRUD operations, Embedded objects and collections, Inheritance, Relationships (Unidirectional and Bidirectional), Queries for JP-QL, JDOQL and SQL (partial), Basic types, Joins.\tabularnewline\hline
No support for & Denormalization, Complex joins and aggregations & Joins & Aggregations? (not specified in documentation)\tabularnewline\hline
Future & High performance sequence generator, parallel key fetching, support for Map/Reduce, more NoSQL classes, better mixing of NoSQL and RDBMS & ? & JPA2.1 full feature list, Official support for Cassandra, Considering a plugin for REDIS\tabularnewline\hline
Commercial support & Red Hat & Oracle (via TopLink) & Supported by DataNucleus team\tabularnewline\hline
Document\-ation & Scattered, inactive forums, official documentation lacking & Bureaucratic forums, information is complete and gathered mainly in the official website & Active forums, acceptable official documentation, but the big advantage comes from user support in form of blogs and posts scattered around the Internet\tabularnewline\hline
\end{tabular}
\end{table}
\end{landscape}
\end{document}
The Output
Best Answer
Fixed! just added the two lines below: