table data crosses the column
% Table generated by Excel2LaTeX from sheet 'Sheet1'
documentclass{article}
usepackage{tabularx,booktabs}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabular}{|p{3em}|p{5em}|p{4em}|p{5em}|p{5em}|p{4em}|p{4em}|p{4em}|}
hline
multirow{2}{*}{textbf{Mobility Model}}
& multicolumn{7}{c}{textbf{Parameter}} \
cmidrule{2-8}& textbf{Basic Description} & textbf{Adaptability for AANETs} & textbf{Support to higher node mobility and Frequent topology updates} & textbf{Safety parameters} & textbf{Mechanical and aerodynamic constraint} & textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabular}%
label{tab:addlabel}%
end{table}%
end{document}
tables horizontal-alignment
add a comment |
% Table generated by Excel2LaTeX from sheet 'Sheet1'
documentclass{article}
usepackage{tabularx,booktabs}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabular}{|p{3em}|p{5em}|p{4em}|p{5em}|p{5em}|p{4em}|p{4em}|p{4em}|}
hline
multirow{2}{*}{textbf{Mobility Model}}
& multicolumn{7}{c}{textbf{Parameter}} \
cmidrule{2-8}& textbf{Basic Description} & textbf{Adaptability for AANETs} & textbf{Support to higher node mobility and Frequent topology updates} & textbf{Safety parameters} & textbf{Mechanical and aerodynamic constraint} & textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabular}%
label{tab:addlabel}%
end{table}%
end{document}
tables horizontal-alignment
1
is an option to make wider text width? for example with addingusepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example tofootnotesize
? also is an option to rotate table that it appears in landscape?
– Zarko
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago
add a comment |
% Table generated by Excel2LaTeX from sheet 'Sheet1'
documentclass{article}
usepackage{tabularx,booktabs}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabular}{|p{3em}|p{5em}|p{4em}|p{5em}|p{5em}|p{4em}|p{4em}|p{4em}|}
hline
multirow{2}{*}{textbf{Mobility Model}}
& multicolumn{7}{c}{textbf{Parameter}} \
cmidrule{2-8}& textbf{Basic Description} & textbf{Adaptability for AANETs} & textbf{Support to higher node mobility and Frequent topology updates} & textbf{Safety parameters} & textbf{Mechanical and aerodynamic constraint} & textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabular}%
label{tab:addlabel}%
end{table}%
end{document}
tables horizontal-alignment
% Table generated by Excel2LaTeX from sheet 'Sheet1'
documentclass{article}
usepackage{tabularx,booktabs}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabular}{|p{3em}|p{5em}|p{4em}|p{5em}|p{5em}|p{4em}|p{4em}|p{4em}|}
hline
multirow{2}{*}{textbf{Mobility Model}}
& multicolumn{7}{c}{textbf{Parameter}} \
cmidrule{2-8}& textbf{Basic Description} & textbf{Adaptability for AANETs} & textbf{Support to higher node mobility and Frequent topology updates} & textbf{Safety parameters} & textbf{Mechanical and aerodynamic constraint} & textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabular}%
label{tab:addlabel}%
end{table}%
end{document}
tables horizontal-alignment
tables horizontal-alignment
edited 15 hours ago
CarLaTeX
33.1k551136
33.1k551136
asked 15 hours ago
monikamonika
364
364
1
is an option to make wider text width? for example with addingusepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example tofootnotesize
? also is an option to rotate table that it appears in landscape?
– Zarko
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago
add a comment |
1
is an option to make wider text width? for example with addingusepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example tofootnotesize
? also is an option to rotate table that it appears in landscape?
– Zarko
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago
1
1
is an option to make wider text width? for example with adding
usepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example to footnotesize
? also is an option to rotate table that it appears in landscape?– Zarko
15 hours ago
is an option to make wider text width? for example with adding
usepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example to footnotesize
? also is an option to rotate table that it appears in landscape?– Zarko
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago
add a comment |
3 Answers
3
active
oldest
votes
One of the issues you're encountering is that pdfLaTeX never hyphenates the first word of a paragraph. The contents of a cell in a p
column form a paragraph, in the TeX-specific sense of the term.
The way to enable hyphenation of the first words in some of the cells -- "Adaptability" and "Mechanical" are prime candidates -- is to slip in a somewhat artificial-looking hspace{0pt}
. In the code below, this is done by setting up new column type, called P
, which is a p
column that sets its contents ragged-right rather than fully justified, while still allowing hyphenation, even of the first word in the cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{array,ragged2e}
newcolumntype{P}[1]{>{RaggedRightarraybackslashhspace{0pt}}p{#1}}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
label{tab:addlabel}
begin{tabular}{|P{4.5em}|P{5em}|P{5em}|P{5em}|%
P{5em} |P{4em}|P{4em}|P{4em}|}
hline
textbf{Mobility Model}
& multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness}
& textbf{Applications} \
hline
end{tabular}
end{table}
end{document}
add a comment |
Here are two (three) more possible solutions. In all of them I have used the tabularx
package to make the tables as wide as the textwidth. I have also replaced the cmidrule
comand by cline
as booktabs' rules don't cooperate well with vertical lines. For an alternative, see the third example.
In the first one, I have used abbreviations for the column headers that are explained below the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|p{1.5cm}|X|X|X|X|X|X|X|}
cline{1-8}
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{BD} & textbf{AA} & textbf{SF} & textbf{SP} & textbf{MC} & textbf{DR} & textbf{AP} \
cline{1-8}
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
In the second example, I have used sidewaystable
from the rotating
package in order to rotate the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{rotating}
usepackage{ragged2e}
newcolumntype{R}{>{RaggedRightletnewline\arraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|R|R|R|R|R|R|R|R|}
hline
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabularx}%
label{tab:addlabel}%
end{sidewaystable}%
end{document}
In this last example I have removed all vertical lines and replaced the horizontal lines by the rules from booktabs. I have also removed the bold from the column headers as it might distract:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{booktabs}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{p{1.5cm}XXXXXXX}
toprule
Mobility Model & multicolumn{7}{c}{Parameter} \
cmidrule{2-8}
& BD & AA & SF & SP & MC & DR & AP \
bottomrule
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
add a comment |
(adding this answer separately from the first, as the solution method is quite different)
Your table doesn't seem to be set up to fully span the available width of the text block. If this were my table, I would switch to a tabularx
environment (with overall width set to textwidth
) and drop the unnecessary bold-facing of the contents of the header cells. The seven data columns employ a column type called C
, which is simply a modified, centered version of the X
column type. A feature is that it's straightforward to allow for varying column widths; the only constraint is that the 7 C
arguments must sum to 7
, which is the number of columns of this type. A principal formatting goal that guided the width choices was to have no more than four rows in any header cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{tabularx,ragged2e,booktabs}
newcolumntype{L}{>{RaggedRightarraybackslashhspace{0pt}}X}
newcolumntype{C}[1]{>{Centeringarraybackslashhspace{0pt}hsize=#1hsize}X}
usepackage[skip=0.333baselineskip]{caption} % optional
newcommandmytab[1]{smash{%
begin{tabular}[t]{@{}l@{}} #1 end{tabular}}}
begin{document}
begin{table}[htbp]
setlengthtabcolsep{3pt} % default value: 6pt
caption{Add caption}
label{tab:addlabel}
small
begin{tabularx}{textwidth}{@{} L
C{0.8}C{1}C{1.5}C{0.8}C{1}C{0.9}C{1} @{}} % 7 args sum to 7
toprule
mytab{Mobility\Model} & multicolumn{7}{c@{}}{Parameters} \
cmidrule(l){2-8}
& Basic Description
& Adaptability for AANETs
& Support for higher node mobility and frequent topology updates
& Safety parameters
& Mechanical and aero-dynamic constraint
& Degree of randomness
& Applications \
midrule
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
bottomrule
end{tabularx}
end{table}
end{document}
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ theC
column type.
– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
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
});
}
});
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%2f478691%2ftable-data-crosses-the-column%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
One of the issues you're encountering is that pdfLaTeX never hyphenates the first word of a paragraph. The contents of a cell in a p
column form a paragraph, in the TeX-specific sense of the term.
The way to enable hyphenation of the first words in some of the cells -- "Adaptability" and "Mechanical" are prime candidates -- is to slip in a somewhat artificial-looking hspace{0pt}
. In the code below, this is done by setting up new column type, called P
, which is a p
column that sets its contents ragged-right rather than fully justified, while still allowing hyphenation, even of the first word in the cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{array,ragged2e}
newcolumntype{P}[1]{>{RaggedRightarraybackslashhspace{0pt}}p{#1}}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
label{tab:addlabel}
begin{tabular}{|P{4.5em}|P{5em}|P{5em}|P{5em}|%
P{5em} |P{4em}|P{4em}|P{4em}|}
hline
textbf{Mobility Model}
& multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness}
& textbf{Applications} \
hline
end{tabular}
end{table}
end{document}
add a comment |
One of the issues you're encountering is that pdfLaTeX never hyphenates the first word of a paragraph. The contents of a cell in a p
column form a paragraph, in the TeX-specific sense of the term.
The way to enable hyphenation of the first words in some of the cells -- "Adaptability" and "Mechanical" are prime candidates -- is to slip in a somewhat artificial-looking hspace{0pt}
. In the code below, this is done by setting up new column type, called P
, which is a p
column that sets its contents ragged-right rather than fully justified, while still allowing hyphenation, even of the first word in the cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{array,ragged2e}
newcolumntype{P}[1]{>{RaggedRightarraybackslashhspace{0pt}}p{#1}}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
label{tab:addlabel}
begin{tabular}{|P{4.5em}|P{5em}|P{5em}|P{5em}|%
P{5em} |P{4em}|P{4em}|P{4em}|}
hline
textbf{Mobility Model}
& multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness}
& textbf{Applications} \
hline
end{tabular}
end{table}
end{document}
add a comment |
One of the issues you're encountering is that pdfLaTeX never hyphenates the first word of a paragraph. The contents of a cell in a p
column form a paragraph, in the TeX-specific sense of the term.
The way to enable hyphenation of the first words in some of the cells -- "Adaptability" and "Mechanical" are prime candidates -- is to slip in a somewhat artificial-looking hspace{0pt}
. In the code below, this is done by setting up new column type, called P
, which is a p
column that sets its contents ragged-right rather than fully justified, while still allowing hyphenation, even of the first word in the cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{array,ragged2e}
newcolumntype{P}[1]{>{RaggedRightarraybackslashhspace{0pt}}p{#1}}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
label{tab:addlabel}
begin{tabular}{|P{4.5em}|P{5em}|P{5em}|P{5em}|%
P{5em} |P{4em}|P{4em}|P{4em}|}
hline
textbf{Mobility Model}
& multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness}
& textbf{Applications} \
hline
end{tabular}
end{table}
end{document}
One of the issues you're encountering is that pdfLaTeX never hyphenates the first word of a paragraph. The contents of a cell in a p
column form a paragraph, in the TeX-specific sense of the term.
The way to enable hyphenation of the first words in some of the cells -- "Adaptability" and "Mechanical" are prime candidates -- is to slip in a somewhat artificial-looking hspace{0pt}
. In the code below, this is done by setting up new column type, called P
, which is a p
column that sets its contents ragged-right rather than fully justified, while still allowing hyphenation, even of the first word in the cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{array,ragged2e}
newcolumntype{P}[1]{>{RaggedRightarraybackslashhspace{0pt}}p{#1}}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
label{tab:addlabel}
begin{tabular}{|P{4.5em}|P{5em}|P{5em}|P{5em}|%
P{5em} |P{4em}|P{4em}|P{4em}|}
hline
textbf{Mobility Model}
& multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness}
& textbf{Applications} \
hline
end{tabular}
end{table}
end{document}
answered 14 hours ago
MicoMico
282k31385774
282k31385774
add a comment |
add a comment |
Here are two (three) more possible solutions. In all of them I have used the tabularx
package to make the tables as wide as the textwidth. I have also replaced the cmidrule
comand by cline
as booktabs' rules don't cooperate well with vertical lines. For an alternative, see the third example.
In the first one, I have used abbreviations for the column headers that are explained below the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|p{1.5cm}|X|X|X|X|X|X|X|}
cline{1-8}
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{BD} & textbf{AA} & textbf{SF} & textbf{SP} & textbf{MC} & textbf{DR} & textbf{AP} \
cline{1-8}
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
In the second example, I have used sidewaystable
from the rotating
package in order to rotate the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{rotating}
usepackage{ragged2e}
newcolumntype{R}{>{RaggedRightletnewline\arraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|R|R|R|R|R|R|R|R|}
hline
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabularx}%
label{tab:addlabel}%
end{sidewaystable}%
end{document}
In this last example I have removed all vertical lines and replaced the horizontal lines by the rules from booktabs. I have also removed the bold from the column headers as it might distract:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{booktabs}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{p{1.5cm}XXXXXXX}
toprule
Mobility Model & multicolumn{7}{c}{Parameter} \
cmidrule{2-8}
& BD & AA & SF & SP & MC & DR & AP \
bottomrule
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
add a comment |
Here are two (three) more possible solutions. In all of them I have used the tabularx
package to make the tables as wide as the textwidth. I have also replaced the cmidrule
comand by cline
as booktabs' rules don't cooperate well with vertical lines. For an alternative, see the third example.
In the first one, I have used abbreviations for the column headers that are explained below the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|p{1.5cm}|X|X|X|X|X|X|X|}
cline{1-8}
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{BD} & textbf{AA} & textbf{SF} & textbf{SP} & textbf{MC} & textbf{DR} & textbf{AP} \
cline{1-8}
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
In the second example, I have used sidewaystable
from the rotating
package in order to rotate the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{rotating}
usepackage{ragged2e}
newcolumntype{R}{>{RaggedRightletnewline\arraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|R|R|R|R|R|R|R|R|}
hline
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabularx}%
label{tab:addlabel}%
end{sidewaystable}%
end{document}
In this last example I have removed all vertical lines and replaced the horizontal lines by the rules from booktabs. I have also removed the bold from the column headers as it might distract:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{booktabs}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{p{1.5cm}XXXXXXX}
toprule
Mobility Model & multicolumn{7}{c}{Parameter} \
cmidrule{2-8}
& BD & AA & SF & SP & MC & DR & AP \
bottomrule
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
add a comment |
Here are two (three) more possible solutions. In all of them I have used the tabularx
package to make the tables as wide as the textwidth. I have also replaced the cmidrule
comand by cline
as booktabs' rules don't cooperate well with vertical lines. For an alternative, see the third example.
In the first one, I have used abbreviations for the column headers that are explained below the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|p{1.5cm}|X|X|X|X|X|X|X|}
cline{1-8}
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{BD} & textbf{AA} & textbf{SF} & textbf{SP} & textbf{MC} & textbf{DR} & textbf{AP} \
cline{1-8}
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
In the second example, I have used sidewaystable
from the rotating
package in order to rotate the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{rotating}
usepackage{ragged2e}
newcolumntype{R}{>{RaggedRightletnewline\arraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|R|R|R|R|R|R|R|R|}
hline
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabularx}%
label{tab:addlabel}%
end{sidewaystable}%
end{document}
In this last example I have removed all vertical lines and replaced the horizontal lines by the rules from booktabs. I have also removed the bold from the column headers as it might distract:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{booktabs}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{p{1.5cm}XXXXXXX}
toprule
Mobility Model & multicolumn{7}{c}{Parameter} \
cmidrule{2-8}
& BD & AA & SF & SP & MC & DR & AP \
bottomrule
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
Here are two (three) more possible solutions. In all of them I have used the tabularx
package to make the tables as wide as the textwidth. I have also replaced the cmidrule
comand by cline
as booktabs' rules don't cooperate well with vertical lines. For an alternative, see the third example.
In the first one, I have used abbreviations for the column headers that are explained below the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|p{1.5cm}|X|X|X|X|X|X|X|}
cline{1-8}
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{BD} & textbf{AA} & textbf{SF} & textbf{SP} & textbf{MC} & textbf{DR} & textbf{AP} \
cline{1-8}
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
In the second example, I have used sidewaystable
from the rotating
package in order to rotate the table:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{rotating}
usepackage{ragged2e}
newcolumntype{R}{>{RaggedRightletnewline\arraybackslashhspace{0pt}}X}
begin{document}
begin{sidewaystable}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{|R|R|R|R|R|R|R|R|}
hline
textbf{Mobility Model} & multicolumn{7}{c|}{textbf{Parameter}} \
cline{2-8}
& textbf{Basic Description}
& textbf{Adaptability for AANETs}
& textbf{Support to higher node mobility and Frequent topology updates}
& textbf{Safety parameters}
& textbf{Mechanical and aerodynamic constraint}
& textbf{Degree of Randomness} & textbf{Applications} \
hline
end{tabularx}%
label{tab:addlabel}%
end{sidewaystable}%
end{document}
In this last example I have removed all vertical lines and replaced the horizontal lines by the rules from booktabs. I have also removed the bold from the column headers as it might distract:
documentclass{article}
usepackage{tabularx}
usepackage{multirow}
usepackage{booktabs}
begin{document}
begin{table}[htbp]
centering
caption{Add caption}
begin{tabularx}{textwidth}{p{1.5cm}XXXXXXX}
toprule
Mobility Model & multicolumn{7}{c}{Parameter} \
cmidrule{2-8}
& BD & AA & SF & SP & MC & DR & AP \
bottomrule
multicolumn{8}{p{textwidth}}{small BD: Basic Description, AA: Adaptability for AANETs, SF: Support to higher node mobility and Frequent topology updates, SP: Safety parameters, MC: Mechanical and aerodynamic constraint, DR: Degree of Randomness, AP: Applications}
end{tabularx}%
label{tab:addlabel}%
end{table}%
end{document}
answered 14 hours ago
leandriisleandriis
9,7751530
9,7751530
add a comment |
add a comment |
(adding this answer separately from the first, as the solution method is quite different)
Your table doesn't seem to be set up to fully span the available width of the text block. If this were my table, I would switch to a tabularx
environment (with overall width set to textwidth
) and drop the unnecessary bold-facing of the contents of the header cells. The seven data columns employ a column type called C
, which is simply a modified, centered version of the X
column type. A feature is that it's straightforward to allow for varying column widths; the only constraint is that the 7 C
arguments must sum to 7
, which is the number of columns of this type. A principal formatting goal that guided the width choices was to have no more than four rows in any header cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{tabularx,ragged2e,booktabs}
newcolumntype{L}{>{RaggedRightarraybackslashhspace{0pt}}X}
newcolumntype{C}[1]{>{Centeringarraybackslashhspace{0pt}hsize=#1hsize}X}
usepackage[skip=0.333baselineskip]{caption} % optional
newcommandmytab[1]{smash{%
begin{tabular}[t]{@{}l@{}} #1 end{tabular}}}
begin{document}
begin{table}[htbp]
setlengthtabcolsep{3pt} % default value: 6pt
caption{Add caption}
label{tab:addlabel}
small
begin{tabularx}{textwidth}{@{} L
C{0.8}C{1}C{1.5}C{0.8}C{1}C{0.9}C{1} @{}} % 7 args sum to 7
toprule
mytab{Mobility\Model} & multicolumn{7}{c@{}}{Parameters} \
cmidrule(l){2-8}
& Basic Description
& Adaptability for AANETs
& Support for higher node mobility and frequent topology updates
& Safety parameters
& Mechanical and aero-dynamic constraint
& Degree of randomness
& Applications \
midrule
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
bottomrule
end{tabularx}
end{table}
end{document}
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ theC
column type.
– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
add a comment |
(adding this answer separately from the first, as the solution method is quite different)
Your table doesn't seem to be set up to fully span the available width of the text block. If this were my table, I would switch to a tabularx
environment (with overall width set to textwidth
) and drop the unnecessary bold-facing of the contents of the header cells. The seven data columns employ a column type called C
, which is simply a modified, centered version of the X
column type. A feature is that it's straightforward to allow for varying column widths; the only constraint is that the 7 C
arguments must sum to 7
, which is the number of columns of this type. A principal formatting goal that guided the width choices was to have no more than four rows in any header cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{tabularx,ragged2e,booktabs}
newcolumntype{L}{>{RaggedRightarraybackslashhspace{0pt}}X}
newcolumntype{C}[1]{>{Centeringarraybackslashhspace{0pt}hsize=#1hsize}X}
usepackage[skip=0.333baselineskip]{caption} % optional
newcommandmytab[1]{smash{%
begin{tabular}[t]{@{}l@{}} #1 end{tabular}}}
begin{document}
begin{table}[htbp]
setlengthtabcolsep{3pt} % default value: 6pt
caption{Add caption}
label{tab:addlabel}
small
begin{tabularx}{textwidth}{@{} L
C{0.8}C{1}C{1.5}C{0.8}C{1}C{0.9}C{1} @{}} % 7 args sum to 7
toprule
mytab{Mobility\Model} & multicolumn{7}{c@{}}{Parameters} \
cmidrule(l){2-8}
& Basic Description
& Adaptability for AANETs
& Support for higher node mobility and frequent topology updates
& Safety parameters
& Mechanical and aero-dynamic constraint
& Degree of randomness
& Applications \
midrule
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
bottomrule
end{tabularx}
end{table}
end{document}
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ theC
column type.
– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
add a comment |
(adding this answer separately from the first, as the solution method is quite different)
Your table doesn't seem to be set up to fully span the available width of the text block. If this were my table, I would switch to a tabularx
environment (with overall width set to textwidth
) and drop the unnecessary bold-facing of the contents of the header cells. The seven data columns employ a column type called C
, which is simply a modified, centered version of the X
column type. A feature is that it's straightforward to allow for varying column widths; the only constraint is that the 7 C
arguments must sum to 7
, which is the number of columns of this type. A principal formatting goal that guided the width choices was to have no more than four rows in any header cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{tabularx,ragged2e,booktabs}
newcolumntype{L}{>{RaggedRightarraybackslashhspace{0pt}}X}
newcolumntype{C}[1]{>{Centeringarraybackslashhspace{0pt}hsize=#1hsize}X}
usepackage[skip=0.333baselineskip]{caption} % optional
newcommandmytab[1]{smash{%
begin{tabular}[t]{@{}l@{}} #1 end{tabular}}}
begin{document}
begin{table}[htbp]
setlengthtabcolsep{3pt} % default value: 6pt
caption{Add caption}
label{tab:addlabel}
small
begin{tabularx}{textwidth}{@{} L
C{0.8}C{1}C{1.5}C{0.8}C{1}C{0.9}C{1} @{}} % 7 args sum to 7
toprule
mytab{Mobility\Model} & multicolumn{7}{c@{}}{Parameters} \
cmidrule(l){2-8}
& Basic Description
& Adaptability for AANETs
& Support for higher node mobility and frequent topology updates
& Safety parameters
& Mechanical and aero-dynamic constraint
& Degree of randomness
& Applications \
midrule
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
bottomrule
end{tabularx}
end{table}
end{document}
(adding this answer separately from the first, as the solution method is quite different)
Your table doesn't seem to be set up to fully span the available width of the text block. If this were my table, I would switch to a tabularx
environment (with overall width set to textwidth
) and drop the unnecessary bold-facing of the contents of the header cells. The seven data columns employ a column type called C
, which is simply a modified, centered version of the X
column type. A feature is that it's straightforward to allow for varying column widths; the only constraint is that the 7 C
arguments must sum to 7
, which is the number of columns of this type. A principal formatting goal that guided the width choices was to have no more than four rows in any header cell.
documentclass{article}
usepackage[letterpaper,margin=1in]{geometry} % set suitable page parameters
usepackage[english]{babel}
usepackage{tabularx,ragged2e,booktabs}
newcolumntype{L}{>{RaggedRightarraybackslashhspace{0pt}}X}
newcolumntype{C}[1]{>{Centeringarraybackslashhspace{0pt}hsize=#1hsize}X}
usepackage[skip=0.333baselineskip]{caption} % optional
newcommandmytab[1]{smash{%
begin{tabular}[t]{@{}l@{}} #1 end{tabular}}}
begin{document}
begin{table}[htbp]
setlengthtabcolsep{3pt} % default value: 6pt
caption{Add caption}
label{tab:addlabel}
small
begin{tabularx}{textwidth}{@{} L
C{0.8}C{1}C{1.5}C{0.8}C{1}C{0.9}C{1} @{}} % 7 args sum to 7
toprule
mytab{Mobility\Model} & multicolumn{7}{c@{}}{Parameters} \
cmidrule(l){2-8}
& Basic Description
& Adaptability for AANETs
& Support for higher node mobility and frequent topology updates
& Safety parameters
& Mechanical and aero-dynamic constraint
& Degree of randomness
& Applications \
midrule
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
blabla & blabla & blabla & blabla & blabla & blabla & blabla & blabla \
bottomrule
end{tabularx}
end{table}
end{document}
edited 13 hours ago
answered 14 hours ago
MicoMico
282k31385774
282k31385774
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ theC
column type.
– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
add a comment |
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ theC
column type.
– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
will you please share the latex code for this
– monika
14 hours ago
will you please share the latex code for this
– monika
14 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ the
C
column type.– Mico
13 hours ago
@monika - Sorry for this gaffe. I've added the code, and also provided a few more comments on how to employ the
C
column type.– Mico
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
thanks alot sir , is it possible to convert this into a long table
– monika
13 hours ago
1
1
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
@monika - That's a separate, new question, which was in no way hinted at in your posting. Please post new queries to ask new questions.
– Mico
13 hours ago
add a comment |
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%2f478691%2ftable-data-crosses-the-column%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
1
is an option to make wider text width? for example with adding
usepackage[margin=25mm]{geometry}
to your document preamble? also reducing font size, for example tofootnotesize
? also is an option to rotate table that it appears in landscape?– Zarko
15 hours ago
usepackage[margin=25mm]{geometry} adding this has no effect.
– monika
15 hours ago
please read all my comments carefully and complete. also comment to your previous question. use only one segment from it will not help you nor me to further help you. btw, if you use my answer on your previous question as basis for your, it would be nice first accept it ...
– Zarko
15 hours ago