1

I am new to LaTeX and for my thesis I need to create some large tables. I have been able to create simple tables in LaTeX, however, I am having quite some difficulty with this one particularly:

Enter image description here

How do I get column 2 and 3 aligned together? In column 2 I want each contextual factor exactly aligned with its definition in column 3.

MWE:

\begin{table}[ht]
\begin{tabular}{ |m{3cm} | m{4.5cm} | m{5cm}| m{4cm} | }
\hline
\textbf {Authors } & \textbf{Contextual factors} & \textbf{Definition} & \textbf{Findings} \\ \hline
\cite{Pavlou2007} & \multirow{3}{*} Trust\\
&Website informativeness\\
&Social presence\\
& blabla \hline \hline
\end{tabular}
\caption{Literature review on contextual factors of privacy concerns} \label{table:7}
\end{table}
5
  • 2
    Welcome to TeX.SE! Can you show us the code you have tried so far, please?
    – Mensch
    Aug 8, 2016 at 14:32
  • 1
    @Sonia -- you can always edit your own questions. and it's always better to put the code into the question itself -- that way the formatting/alignment of the input is retained (particularly important if comments are present!). in addition to the code for just the example, you should show a complete compilable example, starting with \documentclass and ending with \end{document}. that makes it easier for potential helpers to actually help. Aug 8, 2016 at 14:46
  • @Sonia Please use the edit button and add your code to the question. Only there can it be properly formatted, otherwise trying to copy it, will result in a big mess. Aug 8, 2016 at 14:46
  • I recommend taking a look at the booktabs package. Have a bit of a read and consider whether it would be worth modifying the cagey appearance of your table. I'd be happy to recommend something, but it would depend at least somewhat on your preamble. What font size are you using? What margins? How much room, essentially, do we have for the table?
    – Au101
    Aug 9, 2016 at 21:06
  • In general it's good to provide a full MWE. It should be minimal yes, but it should also be complete. Ideally, we should be able to copy and paste your code as is into a file, save it, and compile it, without having to add anything to the code at all. You've also only provided for us a very small amount of your table, which means we have to type in all your text ourselves if we want to experiment! If you've gotten bored and put "blabla" how do you think your potential helpers feel?
    – Au101
    Aug 9, 2016 at 21:07

3 Answers 3

3

I'm not sure if this is what you are looking for, but I quickly tried to mimic your table. I used the \small command to shrink the font a bit and the \renewcommand{\arraystretch}{1.5} to stretch vertical spacings between rows to match your table a bit more, but you can change this of course. Change the {1.5} to a higher or lower number if you want more or less spacing.

I used p{#cm} instead of m{#cm} to define column widths. This will automatically fill in the text where needed and will not exceed the boundary you gave it.

As for the actual table, you can just do this with rows and lines. Your first row (not including column names) would contain 'Pavlou', 'Trust', 'Lots of text here' and 'Trust,...'. Just end this row by adding \\ and begin your next row.

Leave the first column blank, and just type away in the other columns. It should all be aligned correctly as they are on the same row. Keep it simple! Just use empty cells (typing & without giving values) will still make them aligned, just like cells with content.

I hope this helps.

\documentclass{article}
\begin{document}
\begin{table}[h]
\small
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|p{2cm}|p{3cm}|p{4cm}|p{4cm}|}
\hline
Authors & Contextual factors & Definition & Findings\\ \hline
Pavlou et al. (2007) & Trust & A buyer's intentions to accept vulnerability based on her beliefs that transactions with a seller will meet her... & Trust, web site\\
& Website informativeness & The degree to which a website offers information that buyers perceive as useful,... & \\
& Social Pressure & The extent to which a medium is perceived as truly conveying... & \\ \hline
\end{tabular}
\end{table}
\end{document}

Attempt to your table

1
  • Thanx so much for your help! It works perfectly now! :)
    – Lana
    Aug 8, 2016 at 15:30
5

Here is my attempt to replicate parts of your output ;)

Output

enter image description here

Code

\documentclass[10pt]{article}
\usepackage[style=authoryear]{biblatex}
%\usepackage{booktabs}
%\usepackage{lipsum}
\usepackage{xcolor, soul}
\setulcolor{red}

\addbibresource{bibliography.bib}
\begin{document}
\begin{table}
\small
\caption{Some odd looking red lines, along with some information.}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{|l|l|p{4cm}|p{4cm}|}
    \hline
    Authors             & Centextiual factors   & Definition\footnotemark & Findings\\
    \hline
    \cite{testA}        & Trust & ``A buyer´s intentions to accept vulnerability based on her beliefs that transactions with a seller will meet her confident transaction expectations due to the seller's competence, integrity, and benevolence'' & Trust, web site \ul{informativeness} and social presence all decrease information concerns.\\
                    &Website \ul{informativeness}&  ``The degree to which a website offers information that buyers percieve as useful, such as privacy or security practices'' & \\
                    &Social presence    & The extent to which a medium is precieved as truly conveying the presence of the communicating participants''&\\
    \hline
    \cite{testB}        & Internet literacy & ``The ability to use a network-connected computer and internet applications to accomplish practical tasks'' & Internet literacy negatively affects privacy concerns.
    \end{tabular}
\end{table}
\end{document}
0
0

I recommend you to implement the tables in lyx and then edit its latex source in whatever Latex Editor that you have. This way you can implement very complicated tables without needing to consider the details when you are implementing.

5
  • Could you elaborate a bit? What details are you referring to? This could be the start of a good answer, but as it stands now, it is more of a comment.
    – Runar
    Aug 9, 2016 at 13:36
  • Lyx is a program which enables you to see the table like MS word. As such you can easily create complicated tables (for instance table inside another table) while you see the table itself. Hence, working with it will be much easier for complicated tables. This also true for complicated formulas. I usually implement table in Lyx and formulas in mathtype or lyx and then copy it in a latex editor (in my case texstudio). A little editing of the latex source is usually needed before getting the final good result.
    – Hamid
    Aug 9, 2016 at 20:13
  • There are also some online sites on which you can create latex tables graphically, but my preference is Lyx.
    – Hamid
    Aug 9, 2016 at 20:20
  • You should add this to your answer
    – Runar
    Aug 9, 2016 at 21:16
  • No need, this has been answered by others in this site.
    – Hamid
    Aug 9, 2016 at 21:36

You must log in to answer this question.

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