Right-centered columns in tabular*












2















I'd like to right-center a column within a tabular* environment. See the following snippet:



begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}


Which looks like



enter image description here



How to have the last two columns right-centered?










share|improve this question




















  • 2





    To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

    – leandriis
    Mar 10 at 11:15











  • What do you mean by right-centered?

    – Bernard
    Mar 10 at 11:24











  • @Bernard: Maybe not well phrased, but I meant what leandriis answered.

    – Jan
    Mar 10 at 11:28











  • @Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

    – leandriis
    Mar 10 at 11:35
















2















I'd like to right-center a column within a tabular* environment. See the following snippet:



begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}


Which looks like



enter image description here



How to have the last two columns right-centered?










share|improve this question




















  • 2





    To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

    – leandriis
    Mar 10 at 11:15











  • What do you mean by right-centered?

    – Bernard
    Mar 10 at 11:24











  • @Bernard: Maybe not well phrased, but I meant what leandriis answered.

    – Jan
    Mar 10 at 11:28











  • @Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

    – leandriis
    Mar 10 at 11:35














2












2








2


0






I'd like to right-center a column within a tabular* environment. See the following snippet:



begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}


Which looks like



enter image description here



How to have the last two columns right-centered?










share|improve this question
















I'd like to right-center a column within a tabular* environment. See the following snippet:



begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}


Which looks like



enter image description here



How to have the last two columns right-centered?







tables horizontal-alignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 10 at 11:22









Bernard

173k776205




173k776205










asked Mar 10 at 11:06









JanJan

348317




348317








  • 2





    To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

    – leandriis
    Mar 10 at 11:15











  • What do you mean by right-centered?

    – Bernard
    Mar 10 at 11:24











  • @Bernard: Maybe not well phrased, but I meant what leandriis answered.

    – Jan
    Mar 10 at 11:28











  • @Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

    – leandriis
    Mar 10 at 11:35














  • 2





    To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

    – leandriis
    Mar 10 at 11:15











  • What do you mean by right-centered?

    – Bernard
    Mar 10 at 11:24











  • @Bernard: Maybe not well phrased, but I meant what leandriis answered.

    – Jan
    Mar 10 at 11:28











  • @Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

    – leandriis
    Mar 10 at 11:35








2




2





To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

– leandriis
Mar 10 at 11:15





To right align the last two columns, use begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr} instead of begin{tabular*}{textwidth}{l @{extracolsep{fill}} llc} By the way, you defined 4 columns but only use 3 of them

– leandriis
Mar 10 at 11:15













What do you mean by right-centered?

– Bernard
Mar 10 at 11:24





What do you mean by right-centered?

– Bernard
Mar 10 at 11:24













@Bernard: Maybe not well phrased, but I meant what leandriis answered.

– Jan
Mar 10 at 11:28





@Bernard: Maybe not well phrased, but I meant what leandriis answered.

– Jan
Mar 10 at 11:28













@Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

– leandriis
Mar 10 at 11:35





@Jan: The correct english term for 'rechtsbündig' would be flush right, right-aligned or right-justified.

– leandriis
Mar 10 at 11:35










1 Answer
1






active

oldest

votes


















4














In order to right align the second and third column, use r instead of l. In the following MWE, I have also removed the fourth column cpacifier (c) as you only need three columns. I have also added multicolumn{1}{c}{...} in order to center the column headers of the second and third column.



The second table in the MWE ise done using tabularx to make sure that long entries in the first column are automatically split into two or more lines so that the table's with does not exceed the textwidth. In this second table, I have also used rules from the booktabs package. These lines have some vertical white space above and below them.



enter image description here



documentclass{article}

usepackage{booktabs}
usepackage{tabularx}
begin{document}


begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}

bigskip

begin{tabularx}{textwidth}{Xrr}
toprule
textbf{Art} & multicolumn{1}{c}{textbf{Stundensatz}} & multicolumn{1}{c}{textbf{Gesamt}} \
midrule
Doing this & 1,5 à 100 Euro & 150,00 Euro \
This & That & 3 à 100 Euro & 300,00 Euro \
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
Hearing & 1 à 100 Euro & 100,00 Euro \
MwSt. in Höhe von 19% & & 171,00 Euro \
a very long entry a very long entry a very long entry a very long entry & & \
midrule
Gesamt & & 1071,00 Euro \
bottomrule
end{tabularx}

end{document}





share|improve this answer
























  • Thanks for the detailed answer, very appreciated.

    – Jan
    Mar 10 at 11:27











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%2f478707%2fright-centered-columns-in-tabular%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









4














In order to right align the second and third column, use r instead of l. In the following MWE, I have also removed the fourth column cpacifier (c) as you only need three columns. I have also added multicolumn{1}{c}{...} in order to center the column headers of the second and third column.



The second table in the MWE ise done using tabularx to make sure that long entries in the first column are automatically split into two or more lines so that the table's with does not exceed the textwidth. In this second table, I have also used rules from the booktabs package. These lines have some vertical white space above and below them.



enter image description here



documentclass{article}

usepackage{booktabs}
usepackage{tabularx}
begin{document}


begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}

bigskip

begin{tabularx}{textwidth}{Xrr}
toprule
textbf{Art} & multicolumn{1}{c}{textbf{Stundensatz}} & multicolumn{1}{c}{textbf{Gesamt}} \
midrule
Doing this & 1,5 à 100 Euro & 150,00 Euro \
This & That & 3 à 100 Euro & 300,00 Euro \
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
Hearing & 1 à 100 Euro & 100,00 Euro \
MwSt. in Höhe von 19% & & 171,00 Euro \
a very long entry a very long entry a very long entry a very long entry & & \
midrule
Gesamt & & 1071,00 Euro \
bottomrule
end{tabularx}

end{document}





share|improve this answer
























  • Thanks for the detailed answer, very appreciated.

    – Jan
    Mar 10 at 11:27
















4














In order to right align the second and third column, use r instead of l. In the following MWE, I have also removed the fourth column cpacifier (c) as you only need three columns. I have also added multicolumn{1}{c}{...} in order to center the column headers of the second and third column.



The second table in the MWE ise done using tabularx to make sure that long entries in the first column are automatically split into two or more lines so that the table's with does not exceed the textwidth. In this second table, I have also used rules from the booktabs package. These lines have some vertical white space above and below them.



enter image description here



documentclass{article}

usepackage{booktabs}
usepackage{tabularx}
begin{document}


begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}

bigskip

begin{tabularx}{textwidth}{Xrr}
toprule
textbf{Art} & multicolumn{1}{c}{textbf{Stundensatz}} & multicolumn{1}{c}{textbf{Gesamt}} \
midrule
Doing this & 1,5 à 100 Euro & 150,00 Euro \
This & That & 3 à 100 Euro & 300,00 Euro \
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
Hearing & 1 à 100 Euro & 100,00 Euro \
MwSt. in Höhe von 19% & & 171,00 Euro \
a very long entry a very long entry a very long entry a very long entry & & \
midrule
Gesamt & & 1071,00 Euro \
bottomrule
end{tabularx}

end{document}





share|improve this answer
























  • Thanks for the detailed answer, very appreciated.

    – Jan
    Mar 10 at 11:27














4












4








4







In order to right align the second and third column, use r instead of l. In the following MWE, I have also removed the fourth column cpacifier (c) as you only need three columns. I have also added multicolumn{1}{c}{...} in order to center the column headers of the second and third column.



The second table in the MWE ise done using tabularx to make sure that long entries in the first column are automatically split into two or more lines so that the table's with does not exceed the textwidth. In this second table, I have also used rules from the booktabs package. These lines have some vertical white space above and below them.



enter image description here



documentclass{article}

usepackage{booktabs}
usepackage{tabularx}
begin{document}


begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}

bigskip

begin{tabularx}{textwidth}{Xrr}
toprule
textbf{Art} & multicolumn{1}{c}{textbf{Stundensatz}} & multicolumn{1}{c}{textbf{Gesamt}} \
midrule
Doing this & 1,5 à 100 Euro & 150,00 Euro \
This & That & 3 à 100 Euro & 300,00 Euro \
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
Hearing & 1 à 100 Euro & 100,00 Euro \
MwSt. in Höhe von 19% & & 171,00 Euro \
a very long entry a very long entry a very long entry a very long entry & & \
midrule
Gesamt & & 1071,00 Euro \
bottomrule
end{tabularx}

end{document}





share|improve this answer













In order to right align the second and third column, use r instead of l. In the following MWE, I have also removed the fourth column cpacifier (c) as you only need three columns. I have also added multicolumn{1}{c}{...} in order to center the column headers of the second and third column.



The second table in the MWE ise done using tabularx to make sure that long entries in the first column are automatically split into two or more lines so that the table's with does not exceed the textwidth. In this second table, I have also used rules from the booktabs package. These lines have some vertical white space above and below them.



enter image description here



documentclass{article}

usepackage{booktabs}
usepackage{tabularx}
begin{document}


begin{tabular*}{textwidth}{l @{extracolsep{fill}} rr}
hline
textbf{Art} & textbf{Stundensatz} & textbf{Gesamt} \
hline
Doing this & 1,5 à 100 Euro & 150,00 Euro \
hline
This & That & 3 à 100 Euro & 300,00 Euro \
hline
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
hline
Hearing & 1 à 100 Euro & 100,00 Euro \
hline
MwSt. in Höhe von 19% & & 171,00 Euro \
hline
Gesamt & & 1071,00 Euro \
hline
end{tabular*}

bigskip

begin{tabularx}{textwidth}{Xrr}
toprule
textbf{Art} & multicolumn{1}{c}{textbf{Stundensatz}} & multicolumn{1}{c}{textbf{Gesamt}} \
midrule
Doing this & 1,5 à 100 Euro & 150,00 Euro \
This & That & 3 à 100 Euro & 300,00 Euro \
Even more stuff and corrections & 3,5 à 100 Euro & 350,00 Euro \
Hearing & 1 à 100 Euro & 100,00 Euro \
MwSt. in Höhe von 19% & & 171,00 Euro \
a very long entry a very long entry a very long entry a very long entry & & \
midrule
Gesamt & & 1071,00 Euro \
bottomrule
end{tabularx}

end{document}






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 10 at 11:23









leandriisleandriis

10.2k1531




10.2k1531













  • Thanks for the detailed answer, very appreciated.

    – Jan
    Mar 10 at 11:27



















  • Thanks for the detailed answer, very appreciated.

    – Jan
    Mar 10 at 11:27

















Thanks for the detailed answer, very appreciated.

– Jan
Mar 10 at 11:27





Thanks for the detailed answer, very appreciated.

– Jan
Mar 10 at 11:27


















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%2f478707%2fright-centered-columns-in-tabular%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

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?