Align headings nicely
I have this code which is the beginning part of a big table.
begin{table}[H]
begin{tabularx}{textwidth}{XXXXXXXXXXXX}
hline
multicolumn{1}{|X|}{} & multicolumn{1}{X|}{Shaft Diameter} & multicolumn{1}{X|}{Max Torque} &
multicolumn{1}{X|}{Outer Flange Diameter} & multicolumn{1}{X|}{Flange Base Depth} & multicolumn{1}{X|}{Inner Flange Diameter} & multicolumn{1}{X|}{Flange Boss Depth} & multicolumn{1}{X|}{Pitch Centre Diameter} & multicolumn{1}{X|}{Number of Holes} & multicolumn{1}{X|}{Hole Diameter} & multicolumn{1}{X|}{Key Way Width} & multicolumn{1}{X|}{Key Way Depth} \
hline
However, even though the headings are wrapped, they aren't being displayed nicely. Anyway fix for that please?
tables pdftex
New contributor
add a comment |
I have this code which is the beginning part of a big table.
begin{table}[H]
begin{tabularx}{textwidth}{XXXXXXXXXXXX}
hline
multicolumn{1}{|X|}{} & multicolumn{1}{X|}{Shaft Diameter} & multicolumn{1}{X|}{Max Torque} &
multicolumn{1}{X|}{Outer Flange Diameter} & multicolumn{1}{X|}{Flange Base Depth} & multicolumn{1}{X|}{Inner Flange Diameter} & multicolumn{1}{X|}{Flange Boss Depth} & multicolumn{1}{X|}{Pitch Centre Diameter} & multicolumn{1}{X|}{Number of Holes} & multicolumn{1}{X|}{Hole Diameter} & multicolumn{1}{X|}{Key Way Width} & multicolumn{1}{X|}{Key Way Depth} \
hline
However, even though the headings are wrapped, they aren't being displayed nicely. Anyway fix for that please?
tables pdftex
New contributor
2
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago
add a comment |
I have this code which is the beginning part of a big table.
begin{table}[H]
begin{tabularx}{textwidth}{XXXXXXXXXXXX}
hline
multicolumn{1}{|X|}{} & multicolumn{1}{X|}{Shaft Diameter} & multicolumn{1}{X|}{Max Torque} &
multicolumn{1}{X|}{Outer Flange Diameter} & multicolumn{1}{X|}{Flange Base Depth} & multicolumn{1}{X|}{Inner Flange Diameter} & multicolumn{1}{X|}{Flange Boss Depth} & multicolumn{1}{X|}{Pitch Centre Diameter} & multicolumn{1}{X|}{Number of Holes} & multicolumn{1}{X|}{Hole Diameter} & multicolumn{1}{X|}{Key Way Width} & multicolumn{1}{X|}{Key Way Depth} \
hline
However, even though the headings are wrapped, they aren't being displayed nicely. Anyway fix for that please?
tables pdftex
New contributor
I have this code which is the beginning part of a big table.
begin{table}[H]
begin{tabularx}{textwidth}{XXXXXXXXXXXX}
hline
multicolumn{1}{|X|}{} & multicolumn{1}{X|}{Shaft Diameter} & multicolumn{1}{X|}{Max Torque} &
multicolumn{1}{X|}{Outer Flange Diameter} & multicolumn{1}{X|}{Flange Base Depth} & multicolumn{1}{X|}{Inner Flange Diameter} & multicolumn{1}{X|}{Flange Boss Depth} & multicolumn{1}{X|}{Pitch Centre Diameter} & multicolumn{1}{X|}{Number of Holes} & multicolumn{1}{X|}{Hole Diameter} & multicolumn{1}{X|}{Key Way Width} & multicolumn{1}{X|}{Key Way Depth} \
hline
However, even though the headings are wrapped, they aren't being displayed nicely. Anyway fix for that please?
tables pdftex
tables pdftex
New contributor
New contributor
New contributor
asked 2 days ago
HarryHarry
233
233
New contributor
New contributor
2
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago
add a comment |
2
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago
2
2
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
There's no way you can accommodate those long headers in such narrow columns. Hyphenating them is not the solution, because they become utterly unreadable.
You might rotate the headers and make them smaller, but this is much of a “last resort”.
documentclass{article}
usepackage{tabularx,graphicx}
newcommand{mh}[1]{%
multicolumn{1}{c|}{%
makebox[0pt]{%
rotatebox[origin=cl]{90}{%
footnotesizebegin{tabular}{@{}l}#1end{tabular}%
}%
}%
}%
}
begin{document}
noindent
begin{tabularx}{textwidth}{|X|*{11}{>{raggedleftarraybackslash}X|}}
hline
& mh{Shaft Diameter} & mh{Max Torque} &
mh{Outer Flange \ Diameter} & mh{Flange Base \ Depth} &
mh{Inner Flange \ Diameter} & mh{Flange Boss \ Depth} &
mh{Pitch Centre \ Diameter} & mh{Number of Holes} &
mh{Hole Diameter} & mh{Key Way Width} & mh{Key Way Depth} \
hline
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
hline
end{tabularx}
end{document}
However, I'd go for an “indexed” format.
documentclass{article}
usepackage{tabularx,booktabs}
newcommand{mh}[1]{multicolumn{1}{c}{(#1)}}
newcommand{mhd}[2]{mbox{(#1): #2}}
begin{document}
noindent
begin{tabularx}{textwidth}{X*{11}{>{raggedleftarraybackslash}X}}
toprule
& mh{1} & mh{2} & mh{3} & mh{4} & mh{5} & mh{6}
& mh{7} & mh{8} & mh{9} & mh{10} & mh{11} \
midrule
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
bottomrule
end{tabularx}
medskip
{footnotesizeraggedright
mhd{1}{Shaft Diameter};
mhd{2}{Max Torque};
mhd{3}{Outer Flange Diameter};
mhd{4}{Flange Base Depth};
mhd{5}{Inner Flange Diameter};
mhd{6}{Flange Boss Depth};
mhd{7}{Pitch Centre Diameter};
mhd{8}{Number of Holes};
mhd{9}{Hole Diameter};
mhd{10}{Key Way Width};
mhd{11}{Key Way Depth}.\}
end{document}
add a comment |
Given that the table has a header column and eleven [11!] data columns, it's almost certainly necessary to typeset the table in landscape format. One way to do so is to employ a sidewaystable
environment, provided by the rotating
package, instead of a table
environment.
Note that if you use the X
column type for the data columns, it's not necessary to encase the header cells in multicolumn{1}{X|}{...}
"wrappers".
documentclass{article} % choose an appropriate document class
usepackage[a4paper,margin=2.5cm]{geometry} % select suitable page parameters
usepackage[english]{babel} % load language-appropriate hyphenation patterns
usepackage{rotating} % for 'sidewaystable' env.
usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
usepackage{ragged2e} % for 'Centering' macro
newcolumntype{C}{>{Centeringarraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}
setlengthtabcolsep{3pt} % default: 6pt
setlengthextrarowheight{2pt} % for a slightly more open "look"
begin{tabularx}{textwidth}{|*{12}{C|}}
hline
& Shaft Diameter &
Max Torque & Outer Flange Diameter &
Flange Base Depth & Inner Flange Diameter &
Flange Boss Depth & Pitch Centre Diameter &
Number of Holes & Hole Diameter &
Key Way Width & Key Way Depth \
hline
end{tabularx}
end{sidewaystable}
end{document}
add a comment |
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
});
}
});
Harry is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470844%2falign-headings-nicely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There's no way you can accommodate those long headers in such narrow columns. Hyphenating them is not the solution, because they become utterly unreadable.
You might rotate the headers and make them smaller, but this is much of a “last resort”.
documentclass{article}
usepackage{tabularx,graphicx}
newcommand{mh}[1]{%
multicolumn{1}{c|}{%
makebox[0pt]{%
rotatebox[origin=cl]{90}{%
footnotesizebegin{tabular}{@{}l}#1end{tabular}%
}%
}%
}%
}
begin{document}
noindent
begin{tabularx}{textwidth}{|X|*{11}{>{raggedleftarraybackslash}X|}}
hline
& mh{Shaft Diameter} & mh{Max Torque} &
mh{Outer Flange \ Diameter} & mh{Flange Base \ Depth} &
mh{Inner Flange \ Diameter} & mh{Flange Boss \ Depth} &
mh{Pitch Centre \ Diameter} & mh{Number of Holes} &
mh{Hole Diameter} & mh{Key Way Width} & mh{Key Way Depth} \
hline
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
hline
end{tabularx}
end{document}
However, I'd go for an “indexed” format.
documentclass{article}
usepackage{tabularx,booktabs}
newcommand{mh}[1]{multicolumn{1}{c}{(#1)}}
newcommand{mhd}[2]{mbox{(#1): #2}}
begin{document}
noindent
begin{tabularx}{textwidth}{X*{11}{>{raggedleftarraybackslash}X}}
toprule
& mh{1} & mh{2} & mh{3} & mh{4} & mh{5} & mh{6}
& mh{7} & mh{8} & mh{9} & mh{10} & mh{11} \
midrule
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
bottomrule
end{tabularx}
medskip
{footnotesizeraggedright
mhd{1}{Shaft Diameter};
mhd{2}{Max Torque};
mhd{3}{Outer Flange Diameter};
mhd{4}{Flange Base Depth};
mhd{5}{Inner Flange Diameter};
mhd{6}{Flange Boss Depth};
mhd{7}{Pitch Centre Diameter};
mhd{8}{Number of Holes};
mhd{9}{Hole Diameter};
mhd{10}{Key Way Width};
mhd{11}{Key Way Depth}.\}
end{document}
add a comment |
There's no way you can accommodate those long headers in such narrow columns. Hyphenating them is not the solution, because they become utterly unreadable.
You might rotate the headers and make them smaller, but this is much of a “last resort”.
documentclass{article}
usepackage{tabularx,graphicx}
newcommand{mh}[1]{%
multicolumn{1}{c|}{%
makebox[0pt]{%
rotatebox[origin=cl]{90}{%
footnotesizebegin{tabular}{@{}l}#1end{tabular}%
}%
}%
}%
}
begin{document}
noindent
begin{tabularx}{textwidth}{|X|*{11}{>{raggedleftarraybackslash}X|}}
hline
& mh{Shaft Diameter} & mh{Max Torque} &
mh{Outer Flange \ Diameter} & mh{Flange Base \ Depth} &
mh{Inner Flange \ Diameter} & mh{Flange Boss \ Depth} &
mh{Pitch Centre \ Diameter} & mh{Number of Holes} &
mh{Hole Diameter} & mh{Key Way Width} & mh{Key Way Depth} \
hline
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
hline
end{tabularx}
end{document}
However, I'd go for an “indexed” format.
documentclass{article}
usepackage{tabularx,booktabs}
newcommand{mh}[1]{multicolumn{1}{c}{(#1)}}
newcommand{mhd}[2]{mbox{(#1): #2}}
begin{document}
noindent
begin{tabularx}{textwidth}{X*{11}{>{raggedleftarraybackslash}X}}
toprule
& mh{1} & mh{2} & mh{3} & mh{4} & mh{5} & mh{6}
& mh{7} & mh{8} & mh{9} & mh{10} & mh{11} \
midrule
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
bottomrule
end{tabularx}
medskip
{footnotesizeraggedright
mhd{1}{Shaft Diameter};
mhd{2}{Max Torque};
mhd{3}{Outer Flange Diameter};
mhd{4}{Flange Base Depth};
mhd{5}{Inner Flange Diameter};
mhd{6}{Flange Boss Depth};
mhd{7}{Pitch Centre Diameter};
mhd{8}{Number of Holes};
mhd{9}{Hole Diameter};
mhd{10}{Key Way Width};
mhd{11}{Key Way Depth}.\}
end{document}
add a comment |
There's no way you can accommodate those long headers in such narrow columns. Hyphenating them is not the solution, because they become utterly unreadable.
You might rotate the headers and make them smaller, but this is much of a “last resort”.
documentclass{article}
usepackage{tabularx,graphicx}
newcommand{mh}[1]{%
multicolumn{1}{c|}{%
makebox[0pt]{%
rotatebox[origin=cl]{90}{%
footnotesizebegin{tabular}{@{}l}#1end{tabular}%
}%
}%
}%
}
begin{document}
noindent
begin{tabularx}{textwidth}{|X|*{11}{>{raggedleftarraybackslash}X|}}
hline
& mh{Shaft Diameter} & mh{Max Torque} &
mh{Outer Flange \ Diameter} & mh{Flange Base \ Depth} &
mh{Inner Flange \ Diameter} & mh{Flange Boss \ Depth} &
mh{Pitch Centre \ Diameter} & mh{Number of Holes} &
mh{Hole Diameter} & mh{Key Way Width} & mh{Key Way Depth} \
hline
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
hline
end{tabularx}
end{document}
However, I'd go for an “indexed” format.
documentclass{article}
usepackage{tabularx,booktabs}
newcommand{mh}[1]{multicolumn{1}{c}{(#1)}}
newcommand{mhd}[2]{mbox{(#1): #2}}
begin{document}
noindent
begin{tabularx}{textwidth}{X*{11}{>{raggedleftarraybackslash}X}}
toprule
& mh{1} & mh{2} & mh{3} & mh{4} & mh{5} & mh{6}
& mh{7} & mh{8} & mh{9} & mh{10} & mh{11} \
midrule
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
bottomrule
end{tabularx}
medskip
{footnotesizeraggedright
mhd{1}{Shaft Diameter};
mhd{2}{Max Torque};
mhd{3}{Outer Flange Diameter};
mhd{4}{Flange Base Depth};
mhd{5}{Inner Flange Diameter};
mhd{6}{Flange Boss Depth};
mhd{7}{Pitch Centre Diameter};
mhd{8}{Number of Holes};
mhd{9}{Hole Diameter};
mhd{10}{Key Way Width};
mhd{11}{Key Way Depth}.\}
end{document}
There's no way you can accommodate those long headers in such narrow columns. Hyphenating them is not the solution, because they become utterly unreadable.
You might rotate the headers and make them smaller, but this is much of a “last resort”.
documentclass{article}
usepackage{tabularx,graphicx}
newcommand{mh}[1]{%
multicolumn{1}{c|}{%
makebox[0pt]{%
rotatebox[origin=cl]{90}{%
footnotesizebegin{tabular}{@{}l}#1end{tabular}%
}%
}%
}%
}
begin{document}
noindent
begin{tabularx}{textwidth}{|X|*{11}{>{raggedleftarraybackslash}X|}}
hline
& mh{Shaft Diameter} & mh{Max Torque} &
mh{Outer Flange \ Diameter} & mh{Flange Base \ Depth} &
mh{Inner Flange \ Diameter} & mh{Flange Boss \ Depth} &
mh{Pitch Centre \ Diameter} & mh{Number of Holes} &
mh{Hole Diameter} & mh{Key Way Width} & mh{Key Way Depth} \
hline
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
hline
end{tabularx}
end{document}
However, I'd go for an “indexed” format.
documentclass{article}
usepackage{tabularx,booktabs}
newcommand{mh}[1]{multicolumn{1}{c}{(#1)}}
newcommand{mhd}[2]{mbox{(#1): #2}}
begin{document}
noindent
begin{tabularx}{textwidth}{X*{11}{>{raggedleftarraybackslash}X}}
toprule
& mh{1} & mh{2} & mh{3} & mh{4} & mh{5} & mh{6}
& mh{7} & mh{8} & mh{9} & mh{10} & mh{11} \
midrule
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
a & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \
bottomrule
end{tabularx}
medskip
{footnotesizeraggedright
mhd{1}{Shaft Diameter};
mhd{2}{Max Torque};
mhd{3}{Outer Flange Diameter};
mhd{4}{Flange Base Depth};
mhd{5}{Inner Flange Diameter};
mhd{6}{Flange Boss Depth};
mhd{7}{Pitch Centre Diameter};
mhd{8}{Number of Holes};
mhd{9}{Hole Diameter};
mhd{10}{Key Way Width};
mhd{11}{Key Way Depth}.\}
end{document}
answered 2 days ago
egregegreg
714k8618963184
714k8618963184
add a comment |
add a comment |
Given that the table has a header column and eleven [11!] data columns, it's almost certainly necessary to typeset the table in landscape format. One way to do so is to employ a sidewaystable
environment, provided by the rotating
package, instead of a table
environment.
Note that if you use the X
column type for the data columns, it's not necessary to encase the header cells in multicolumn{1}{X|}{...}
"wrappers".
documentclass{article} % choose an appropriate document class
usepackage[a4paper,margin=2.5cm]{geometry} % select suitable page parameters
usepackage[english]{babel} % load language-appropriate hyphenation patterns
usepackage{rotating} % for 'sidewaystable' env.
usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
usepackage{ragged2e} % for 'Centering' macro
newcolumntype{C}{>{Centeringarraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}
setlengthtabcolsep{3pt} % default: 6pt
setlengthextrarowheight{2pt} % for a slightly more open "look"
begin{tabularx}{textwidth}{|*{12}{C|}}
hline
& Shaft Diameter &
Max Torque & Outer Flange Diameter &
Flange Base Depth & Inner Flange Diameter &
Flange Boss Depth & Pitch Centre Diameter &
Number of Holes & Hole Diameter &
Key Way Width & Key Way Depth \
hline
end{tabularx}
end{sidewaystable}
end{document}
add a comment |
Given that the table has a header column and eleven [11!] data columns, it's almost certainly necessary to typeset the table in landscape format. One way to do so is to employ a sidewaystable
environment, provided by the rotating
package, instead of a table
environment.
Note that if you use the X
column type for the data columns, it's not necessary to encase the header cells in multicolumn{1}{X|}{...}
"wrappers".
documentclass{article} % choose an appropriate document class
usepackage[a4paper,margin=2.5cm]{geometry} % select suitable page parameters
usepackage[english]{babel} % load language-appropriate hyphenation patterns
usepackage{rotating} % for 'sidewaystable' env.
usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
usepackage{ragged2e} % for 'Centering' macro
newcolumntype{C}{>{Centeringarraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}
setlengthtabcolsep{3pt} % default: 6pt
setlengthextrarowheight{2pt} % for a slightly more open "look"
begin{tabularx}{textwidth}{|*{12}{C|}}
hline
& Shaft Diameter &
Max Torque & Outer Flange Diameter &
Flange Base Depth & Inner Flange Diameter &
Flange Boss Depth & Pitch Centre Diameter &
Number of Holes & Hole Diameter &
Key Way Width & Key Way Depth \
hline
end{tabularx}
end{sidewaystable}
end{document}
add a comment |
Given that the table has a header column and eleven [11!] data columns, it's almost certainly necessary to typeset the table in landscape format. One way to do so is to employ a sidewaystable
environment, provided by the rotating
package, instead of a table
environment.
Note that if you use the X
column type for the data columns, it's not necessary to encase the header cells in multicolumn{1}{X|}{...}
"wrappers".
documentclass{article} % choose an appropriate document class
usepackage[a4paper,margin=2.5cm]{geometry} % select suitable page parameters
usepackage[english]{babel} % load language-appropriate hyphenation patterns
usepackage{rotating} % for 'sidewaystable' env.
usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
usepackage{ragged2e} % for 'Centering' macro
newcolumntype{C}{>{Centeringarraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}
setlengthtabcolsep{3pt} % default: 6pt
setlengthextrarowheight{2pt} % for a slightly more open "look"
begin{tabularx}{textwidth}{|*{12}{C|}}
hline
& Shaft Diameter &
Max Torque & Outer Flange Diameter &
Flange Base Depth & Inner Flange Diameter &
Flange Boss Depth & Pitch Centre Diameter &
Number of Holes & Hole Diameter &
Key Way Width & Key Way Depth \
hline
end{tabularx}
end{sidewaystable}
end{document}
Given that the table has a header column and eleven [11!] data columns, it's almost certainly necessary to typeset the table in landscape format. One way to do so is to employ a sidewaystable
environment, provided by the rotating
package, instead of a table
environment.
Note that if you use the X
column type for the data columns, it's not necessary to encase the header cells in multicolumn{1}{X|}{...}
"wrappers".
documentclass{article} % choose an appropriate document class
usepackage[a4paper,margin=2.5cm]{geometry} % select suitable page parameters
usepackage[english]{babel} % load language-appropriate hyphenation patterns
usepackage{rotating} % for 'sidewaystable' env.
usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
usepackage{ragged2e} % for 'Centering' macro
newcolumntype{C}{>{Centeringarraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}
setlengthtabcolsep{3pt} % default: 6pt
setlengthextrarowheight{2pt} % for a slightly more open "look"
begin{tabularx}{textwidth}{|*{12}{C|}}
hline
& Shaft Diameter &
Max Torque & Outer Flange Diameter &
Flange Base Depth & Inner Flange Diameter &
Flange Boss Depth & Pitch Centre Diameter &
Number of Holes & Hole Diameter &
Key Way Width & Key Way Depth \
hline
end{tabularx}
end{sidewaystable}
end{document}
answered 2 days ago
MicoMico
275k30374763
275k30374763
add a comment |
add a comment |
Harry is a new contributor. Be nice, and check out our Code of Conduct.
Harry is a new contributor. Be nice, and check out our Code of Conduct.
Harry is a new contributor. Be nice, and check out our Code of Conduct.
Harry is a new contributor. Be nice, and check out our Code of Conduct.
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470844%2falign-headings-nicely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
2
Welcome to TeX.SX! Please turn your code fragment into a compilable minimal working example (MWE) including the documentclass and all relevant packages that are needed to recreate your problem. Please also clarify on your desired alignment maybe by using a sketch.
– leandriis
2 days ago
What's the main document font size, and how wide is the textblock?
– Mico
2 days ago