0
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{tabularx}

\begin{document}


\newcounter{question}
\setcounter{question}{0}

\newcommand\Q{%
\refstepcounter{question}
\paragraph{Question \thequestion.}
}

\newcommand\A{%
\smallskip
}

\Q Question.

\A

\begin{table}[h!]
    \begin{tabular}{lll}
        \hline
        ~ & HR application & Manufacturing application \\
        \hline
        Agency monitoring & \multicolumn{2}{l}{CIO over two units} \\
        Agency bonding & \multicolumn{2}{l}{Units over CIO} \\
        Agency residual loss & \multicolumn{2}{l}{Dissatisfaction, misunderstandings...} \\
        \hline
        Transaction cost & \multicolumn{2}{l}{Search company, contract stipulation, relationship with outsourcer (communications, meetings...)} \\
        \hline
        Decision & \multicolumn{2}{l}{Collection and communications} \\
        \hline
    \end{tabular}
\end{table}

\end{document}

How can I wrap the table inside the page margins centralizing it and to get a new line if the text is too much to be contained inside the column margins?

enter image description here

enter image description here

UPDATE1:

\begin{tabularx}{\textwidth}{lX}
    \toprule
                      & HR application \hfill Manufacturing application \\
    \hline
    Agency monitoring & CIO over two units     \\ 
    Agency bonding    & Units over CIO          \\
    Agency residual loss & Dissatisfaction, misunderstandings... \\
    Transaction cost  & Search company, contract stipulation, relationship with 
    outsourcer communications, meetings \\
    Decision          & Collection and communications \\
    \bottomrule
\end{tabularx}

gives me the following result

enter image description here

However I need that HR application and Manufacturing application create two different columns.

This table

\begin{tabularx}{\textwidth}{lll}
    \toprule
    Agency monitoring & Control employees & Control company service \\
    Agency bonding & Employees' report & Company report \\
    Agency residual loss & None & None \\
    \hline
    Transaction cost & None & Search company, establish contract \\
    \hline
    Decision & Collection of KPIs, cleaning logs & Collection of KPIs, cleaning logs \\
    \hline
    KPI1 - Cost & Cost of employees and equipment & Cost of service \\
    KPI2 - Quality & \multicolumn{2}{l}{Level of cleanness} \\
    KPI3 - Frequency & \multicolumn{2}{l}{Frequency of cleaning, n times per week a place is cleaned} \\
    \bottomrule
\end{tabularx}

include columns with text out of table margins. Is it possible to have all two tables aligned with the paragraphs?

enter image description here

1
  • wish you had added the entire able in the first place--fragments of information interrupt the flow--suggest to accept the answer below and post a fresh question with complete requirement
    – js bibra
    Jan 21, 2020 at 16:12

2 Answers 2

0

enter image description here

Is this what you look for

    \documentclass{article}
    \usepackage{caption,tabularx,booktabs}
    \usepackage[table]{xcolor}
    \usepackage{showframe}
    \usepackage{multirow}
    \begin{document}
    \begin{table}
    \rowcolors{2}{gray!25}{white}
    \begin{tabularx}{\textwidth}{lXl}

    \hline \rowcolor{green!20}
                      & HR application & Manufacturing application \\
    Agency monitoring & CIO over two units &    \\ 
    Agency bonding    & Units over CIO      &    \\
    Agency residual loss & Dissatisfaction, misunderstandings...& \\
    Transaction cost  & Search company, contract stipulation, relationship 
    with outsourcer communications, meetings &\\
    Decision          & Collection and communications &\\        \hline
    \end{tabularx}
    \end{table}
    \end{document}

OR

enter image description here

\begin{tabularx}{\textwidth}{lX}
\toprule \rowcolor{green!20}
                  & HR application \hfill Manufacturing application \\
Agency monitoring & CIO over two units     \\ 
Agency bonding    & Units over CIO          \\
Agency residual loss & Dissatisfaction, misunderstandings... \\
Transaction cost  & Search company, contract stipulation, relationship with 
outsourcer communications, meetings \\
Decision          & Collection and communications \\        \bottomrule
\end{tabularx}
3
  • The second one is what I was looking for but it gives me a warning "Overfull \hbox (15.0pt too wide)". Can you explain why your solution works and what is that warning?
    – TonyRomero
    Jan 21, 2020 at 15:55
  • paste your code as an edit to your original question--only then some analysis
    – js bibra
    Jan 21, 2020 at 15:56
  • I've added the previous table and another one but there's one more problem with that.
    – TonyRomero
    Jan 21, 2020 at 16:03
0

enter image description here

It is not clear if the text in the cells of the third colum is approximately equal long As in the second column, but I anticipatated that it is. Therefore I select equal width of both X columns:

\documentclass{article}
\usepackage{caption}
\usepackage{ragged2e}   % <--- for smart hyphenation of cell's contents
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}
    \setcellgapes{2pt} % <---
    \makegapedcells    % <--- for more vertical spaces around thext in cells
\begin{tabularx}{\textwidth}{@{} l *{2}{>{\RaggedRight}X} @{}}
    \toprule
                    & \multicolumn{2}{c}{\thead{Application}}   \\
    \cmidrule(l){2-3}
                    & \thead{HR}         & \thead{Manufacturing} \\
    \midrule
Agency monitoring   & CIO over two units    &    \\
Agency bonding      & Units over CIO        &    \\
Agency residual loss 
                    & Dissatisfaction, misunderstandings \dots
                                            &   \\
Transaction cost    & Search company, contract stipulation,
                      relationship with outsourcer communications, meetings 
                                            &   \\
Decision            & Collection and communications 
                                            &   \\        
    \bottomrule
\end{tabularx}
        \end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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