Table with merged cells, multi-index and text wrap












0















I'd like to have a table that looks like this. Here's a link to open the image in another tab.



table



What matters to me is the structure. The formatting is just to show what I'd like to stand out from the rest in some way.



How do I:




  1. Make sure text is wrapped when the data has over a specific length.

  2. Use a multicolumn for the bottom right cells, as per the image?


Here's what I have:



documentclass[11pt]{article}
usepackage{multirow}
begin{document}
% Text data placeholder. May be long enough that it needs to be wrapped.
begin{table}[ht]
begin{center}
begin{tabular}{cccc}
hline
multirow{2}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{2}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{6}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.3 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.4 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.6 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
end{tabular}
end{center}
end{table}

end{document}


Better formatting is welcome. Feel free to add your own touch.










share|improve this question




















  • 2





    Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

    – JouleV
    Mar 20 at 13:06






  • 1





    Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

    – leandriis
    Mar 20 at 13:06











  • @whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

    – leandriis
    Mar 20 at 14:38











  • @leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

    – whoami
    Mar 20 at 14:39











  • @whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

    – leandriis
    Mar 20 at 15:34


















0















I'd like to have a table that looks like this. Here's a link to open the image in another tab.



table



What matters to me is the structure. The formatting is just to show what I'd like to stand out from the rest in some way.



How do I:




  1. Make sure text is wrapped when the data has over a specific length.

  2. Use a multicolumn for the bottom right cells, as per the image?


Here's what I have:



documentclass[11pt]{article}
usepackage{multirow}
begin{document}
% Text data placeholder. May be long enough that it needs to be wrapped.
begin{table}[ht]
begin{center}
begin{tabular}{cccc}
hline
multirow{2}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{2}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{6}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.3 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.4 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.6 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
end{tabular}
end{center}
end{table}

end{document}


Better formatting is welcome. Feel free to add your own touch.










share|improve this question




















  • 2





    Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

    – JouleV
    Mar 20 at 13:06






  • 1





    Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

    – leandriis
    Mar 20 at 13:06











  • @whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

    – leandriis
    Mar 20 at 14:38











  • @leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

    – whoami
    Mar 20 at 14:39











  • @whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

    – leandriis
    Mar 20 at 15:34
















0












0








0


1






I'd like to have a table that looks like this. Here's a link to open the image in another tab.



table



What matters to me is the structure. The formatting is just to show what I'd like to stand out from the rest in some way.



How do I:




  1. Make sure text is wrapped when the data has over a specific length.

  2. Use a multicolumn for the bottom right cells, as per the image?


Here's what I have:



documentclass[11pt]{article}
usepackage{multirow}
begin{document}
% Text data placeholder. May be long enough that it needs to be wrapped.
begin{table}[ht]
begin{center}
begin{tabular}{cccc}
hline
multirow{2}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{2}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{6}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.3 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.4 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.6 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
end{tabular}
end{center}
end{table}

end{document}


Better formatting is welcome. Feel free to add your own touch.










share|improve this question
















I'd like to have a table that looks like this. Here's a link to open the image in another tab.



table



What matters to me is the structure. The formatting is just to show what I'd like to stand out from the rest in some way.



How do I:




  1. Make sure text is wrapped when the data has over a specific length.

  2. Use a multicolumn for the bottom right cells, as per the image?


Here's what I have:



documentclass[11pt]{article}
usepackage{multirow}
begin{document}
% Text data placeholder. May be long enough that it needs to be wrapped.
begin{table}[ht]
begin{center}
begin{tabular}{cccc}
hline
multirow{2}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{2}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
multirow{6}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.3 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.4 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.5 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
&Inner index 3.6 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
hline
end{tabular}
end{center}
end{table}

end{document}


Better formatting is welcome. Feel free to add your own touch.







tables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 at 15:34









leandriis

10.9k1732




10.9k1732










asked Mar 20 at 13:00









whoamiwhoami

344




344








  • 2





    Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

    – JouleV
    Mar 20 at 13:06






  • 1





    Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

    – leandriis
    Mar 20 at 13:06











  • @whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

    – leandriis
    Mar 20 at 14:38











  • @leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

    – whoami
    Mar 20 at 14:39











  • @whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

    – leandriis
    Mar 20 at 15:34
















  • 2





    Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

    – JouleV
    Mar 20 at 13:06






  • 1





    Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

    – leandriis
    Mar 20 at 13:06











  • @whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

    – leandriis
    Mar 20 at 14:38











  • @leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

    – whoami
    Mar 20 at 14:39











  • @whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

    – leandriis
    Mar 20 at 15:34










2




2





Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

– JouleV
Mar 20 at 13:06





Welcome to TeX.SE! I think multicolumn is what you want. Anyway, please add a minimal working example.

– JouleV
Mar 20 at 13:06




1




1





Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

– leandriis
Mar 20 at 13:06





Welcome to TeX.SX! Could you please add a minimal working example (MWE) of what you have acmoplished so far to illustrate your problem?

– leandriis
Mar 20 at 13:06













@whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

– leandriis
Mar 20 at 14:38





@whoami: Please add the code directly to your question (by using the edit button). Content from external sites might be removed in the future which makes a question that relies on externally shown code unusable for future readers.

– leandriis
Mar 20 at 14:38













@leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

– whoami
Mar 20 at 14:39





@leandriis My code wasn't a minimal example yet, that's why I didn't add it to the question. I now have a minimal example and I'm about to add it. Thank you for your guideance.

– whoami
Mar 20 at 14:39













@whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

– leandriis
Mar 20 at 15:34







@whoami: I have removed the pgfplotstable and threeparttable tags from your question as you do not use the corresponding packages in your MWE.

– leandriis
Mar 20 at 15:34












1 Answer
1






active

oldest

votes


















1














The following includes:





  • tabularx for X type columns and a table that fits the textwidth


  • multicolumn for the cells spanning 2 columns

  • adjusted values of multirow to vertically center the text in the first column

  • replaced center environment by centering as the former adds additional white space around the table


  • used horizontal lines from the booktabs package for improved spacing.



    documentclass[11pt]{article}

    usepackage{multirow}
    usepackage{geometry}
    usepackage{tabularx}
    usepackage{booktabs}
    usepackage{ragged2e}
    begin{document}

    begin{table}[ht]
    centering
    begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
    toprule
    multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{9}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    &Inner index 3.2 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    &Inner index 3.3 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    bottomrule
    end{tabularx}
    end{table}

    end{document}



enter image description here





Here, I have also used multirow for the contents of the second column:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & multirow{3}{*}{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & multirow{3}{*}{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & multirow{3}{*}{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& multirow{3}{*}{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}


enter image description here





In oder to vertically center the text in the second column, you could also use the makecell package in combination with vertically centered X type columns as shown in the following MWE:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
usepackage{makecell}
renewcommand{tabularxcolumn}[1]{m{#1}}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & makecell[cc]{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & makecell[cc]{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & makecell[cc]{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& makecell[cc]{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}





share|improve this answer


























  • Thanks! Is there a way to vertically center the first two columns?

    – whoami
    Mar 20 at 16:29











  • For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

    – leandriis
    Mar 20 at 16:32











  • Isn't that what is already being done? They aren't centered for me.

    – whoami
    Mar 20 at 17:51











  • @whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

    – leandriis
    Mar 20 at 18:37











  • Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

    – whoami
    Mar 20 at 19:01












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480479%2ftable-with-merged-cells-multi-index-and-text-wrap%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The following includes:





  • tabularx for X type columns and a table that fits the textwidth


  • multicolumn for the cells spanning 2 columns

  • adjusted values of multirow to vertically center the text in the first column

  • replaced center environment by centering as the former adds additional white space around the table


  • used horizontal lines from the booktabs package for improved spacing.



    documentclass[11pt]{article}

    usepackage{multirow}
    usepackage{geometry}
    usepackage{tabularx}
    usepackage{booktabs}
    usepackage{ragged2e}
    begin{document}

    begin{table}[ht]
    centering
    begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
    toprule
    multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{9}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    &Inner index 3.2 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    &Inner index 3.3 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    bottomrule
    end{tabularx}
    end{table}

    end{document}



enter image description here





Here, I have also used multirow for the contents of the second column:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & multirow{3}{*}{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & multirow{3}{*}{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & multirow{3}{*}{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& multirow{3}{*}{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}


enter image description here





In oder to vertically center the text in the second column, you could also use the makecell package in combination with vertically centered X type columns as shown in the following MWE:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
usepackage{makecell}
renewcommand{tabularxcolumn}[1]{m{#1}}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & makecell[cc]{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & makecell[cc]{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & makecell[cc]{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& makecell[cc]{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}





share|improve this answer


























  • Thanks! Is there a way to vertically center the first two columns?

    – whoami
    Mar 20 at 16:29











  • For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

    – leandriis
    Mar 20 at 16:32











  • Isn't that what is already being done? They aren't centered for me.

    – whoami
    Mar 20 at 17:51











  • @whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

    – leandriis
    Mar 20 at 18:37











  • Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

    – whoami
    Mar 20 at 19:01
















1














The following includes:





  • tabularx for X type columns and a table that fits the textwidth


  • multicolumn for the cells spanning 2 columns

  • adjusted values of multirow to vertically center the text in the first column

  • replaced center environment by centering as the former adds additional white space around the table


  • used horizontal lines from the booktabs package for improved spacing.



    documentclass[11pt]{article}

    usepackage{multirow}
    usepackage{geometry}
    usepackage{tabularx}
    usepackage{booktabs}
    usepackage{ragged2e}
    begin{document}

    begin{table}[ht]
    centering
    begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
    toprule
    multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{9}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    &Inner index 3.2 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    &Inner index 3.3 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    bottomrule
    end{tabularx}
    end{table}

    end{document}



enter image description here





Here, I have also used multirow for the contents of the second column:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & multirow{3}{*}{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & multirow{3}{*}{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & multirow{3}{*}{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& multirow{3}{*}{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}


enter image description here





In oder to vertically center the text in the second column, you could also use the makecell package in combination with vertically centered X type columns as shown in the following MWE:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
usepackage{makecell}
renewcommand{tabularxcolumn}[1]{m{#1}}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & makecell[cc]{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & makecell[cc]{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & makecell[cc]{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& makecell[cc]{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}





share|improve this answer


























  • Thanks! Is there a way to vertically center the first two columns?

    – whoami
    Mar 20 at 16:29











  • For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

    – leandriis
    Mar 20 at 16:32











  • Isn't that what is already being done? They aren't centered for me.

    – whoami
    Mar 20 at 17:51











  • @whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

    – leandriis
    Mar 20 at 18:37











  • Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

    – whoami
    Mar 20 at 19:01














1












1








1







The following includes:





  • tabularx for X type columns and a table that fits the textwidth


  • multicolumn for the cells spanning 2 columns

  • adjusted values of multirow to vertically center the text in the first column

  • replaced center environment by centering as the former adds additional white space around the table


  • used horizontal lines from the booktabs package for improved spacing.



    documentclass[11pt]{article}

    usepackage{multirow}
    usepackage{geometry}
    usepackage{tabularx}
    usepackage{booktabs}
    usepackage{ragged2e}
    begin{document}

    begin{table}[ht]
    centering
    begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
    toprule
    multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{9}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    &Inner index 3.2 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    &Inner index 3.3 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    bottomrule
    end{tabularx}
    end{table}

    end{document}



enter image description here





Here, I have also used multirow for the contents of the second column:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & multirow{3}{*}{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & multirow{3}{*}{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & multirow{3}{*}{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& multirow{3}{*}{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}


enter image description here





In oder to vertically center the text in the second column, you could also use the makecell package in combination with vertically centered X type columns as shown in the following MWE:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
usepackage{makecell}
renewcommand{tabularxcolumn}[1]{m{#1}}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & makecell[cc]{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & makecell[cc]{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & makecell[cc]{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& makecell[cc]{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}





share|improve this answer















The following includes:





  • tabularx for X type columns and a table that fits the textwidth


  • multicolumn for the cells spanning 2 columns

  • adjusted values of multirow to vertically center the text in the first column

  • replaced center environment by centering as the former adds additional white space around the table


  • used horizontal lines from the booktabs package for improved spacing.



    documentclass[11pt]{article}

    usepackage{multirow}
    usepackage{geometry}
    usepackage{tabularx}
    usepackage{booktabs}
    usepackage{ragged2e}
    begin{document}

    begin{table}[ht]
    centering
    begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
    toprule
    multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    midrule
    multirow{9}{*}{Outer index 3} & Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
    &Inner index 3.2 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    &Inner index 3.3 & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
    bottomrule
    end{tabularx}
    end{table}

    end{document}



enter image description here





Here, I have also used multirow for the contents of the second column:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & multirow{3}{*}{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & multirow{3}{*}{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & multirow{3}{*}{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& multirow{3}{*}{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& multirow{3}{*}{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}


enter image description here





In oder to vertically center the text in the second column, you could also use the makecell package in combination with vertically centered X type columns as shown in the following MWE:



documentclass[11pt]{article}

usepackage{multirow}
usepackage{geometry}
usepackage{tabularx}
usepackage{booktabs}
usepackage{ragged2e}
usepackage{makecell}
renewcommand{tabularxcolumn}[1]{m{#1}}
begin{document}

begin{table}[ht]
centering
begin{tabularx}{textwidth}{cc>{RaggedRightarraybackslash}X>{RaggedRightarraybackslash}X}
toprule
multirow{6}{*}{Outer index 1} & makecell[cc]{Inner index 1.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 1.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{6}{*}{Outer index 2} & makecell[cc]{Inner index 2.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 2.2} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
midrule
multirow{9}{*}{Outer index 3} & makecell[cc]{Inner index 3.1} & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\
& makecell[cc]{Inner index 3.2} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
& makecell[cc]{Inner index 3.3} & multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolsep+arrayrulewidthrelaxRaggedRightarraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\
bottomrule
end{tabularx}
end{table}

end{document}






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 20 at 19:05

























answered Mar 20 at 15:04









leandriisleandriis

10.9k1732




10.9k1732













  • Thanks! Is there a way to vertically center the first two columns?

    – whoami
    Mar 20 at 16:29











  • For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

    – leandriis
    Mar 20 at 16:32











  • Isn't that what is already being done? They aren't centered for me.

    – whoami
    Mar 20 at 17:51











  • @whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

    – leandriis
    Mar 20 at 18:37











  • Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

    – whoami
    Mar 20 at 19:01



















  • Thanks! Is there a way to vertically center the first two columns?

    – whoami
    Mar 20 at 16:29











  • For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

    – leandriis
    Mar 20 at 16:32











  • Isn't that what is already being done? They aren't centered for me.

    – whoami
    Mar 20 at 17:51











  • @whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

    – leandriis
    Mar 20 at 18:37











  • Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

    – whoami
    Mar 20 at 19:01

















Thanks! Is there a way to vertically center the first two columns?

– whoami
Mar 20 at 16:29





Thanks! Is there a way to vertically center the first two columns?

– whoami
Mar 20 at 16:29













For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

– leandriis
Mar 20 at 16:32





For the contents of the second column use multirow{3}{*}{<your text>}. If you add more rows you might need to adjust the number in the first argument of multirow in the first column accordingly.

– leandriis
Mar 20 at 16:32













Isn't that what is already being done? They aren't centered for me.

– whoami
Mar 20 at 17:51





Isn't that what is already being done? They aren't centered for me.

– whoami
Mar 20 at 17:51













@whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

– leandriis
Mar 20 at 18:37





@whoami: I have added a second MWE showing how to vertically center the contents of the second column. I have also added images of the output I obtain from the two different examples.

– leandriis
Mar 20 at 18:37













Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

– whoami
Mar 20 at 19:01





Thanks. But won't this potentially fail to be centered when the text is different? Because the text I'm using is different and I don't want to rely on my very bad eyes to assess what value centers the indices.

– whoami
Mar 20 at 19:01


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480479%2ftable-with-merged-cells-multi-index-and-text-wrap%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?