How to position text in the top of all columns in the upper row of a table [diagbox]
up vote
1
down vote
favorite
How can I get '1', '2', '3', '4', and 'Supply' (i.e. the entries in the first row (but in different columns)) on the same height (vertical position) as 'Destination' (i.e. at the top of the columns instead of in the middle of the columns)?
Due to using the 'diagbox' option, the vertical position of these elements is off.
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
diagbox{textbf{Source}}{textbf{Destination}} & $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
tables diagbox
add a comment |
up vote
1
down vote
favorite
How can I get '1', '2', '3', '4', and 'Supply' (i.e. the entries in the first row (but in different columns)) on the same height (vertical position) as 'Destination' (i.e. at the top of the columns instead of in the middle of the columns)?
Due to using the 'diagbox' option, the vertical position of these elements is off.
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
diagbox{textbf{Source}}{textbf{Destination}} & $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
tables diagbox
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
How can I get '1', '2', '3', '4', and 'Supply' (i.e. the entries in the first row (but in different columns)) on the same height (vertical position) as 'Destination' (i.e. at the top of the columns instead of in the middle of the columns)?
Due to using the 'diagbox' option, the vertical position of these elements is off.
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
diagbox{textbf{Source}}{textbf{Destination}} & $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
tables diagbox
How can I get '1', '2', '3', '4', and 'Supply' (i.e. the entries in the first row (but in different columns)) on the same height (vertical position) as 'Destination' (i.e. at the top of the columns instead of in the middle of the columns)?
Due to using the 'diagbox' option, the vertical position of these elements is off.
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
diagbox{textbf{Source}}{textbf{Destination}} & $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
tables diagbox
tables diagbox
edited 3 hours ago
asked 4 hours ago
Anna
234
234
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago
add a comment |
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
meanwhile when you wait on desired solution, see if the following redesign of your table is acceptable to you:
documentclass[12pt,fleqn]{article}
%usepackage{pict2e} % not needed in this mwe
%usepackage{keyval} % not needed in this mwe
%usepackage{calc} % not needed in this mwe
%usepackage{fp} % not needed in this mwe
%usepackage{diagbox}
usepackage{booktabs,
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
caption[short caption]{long caption}
label{tab:table1}
centering
begin{tabular}{*{6}{>{$}c<{$}} }
toprule
multirow{2.4}{*}{textbf{Source}}
& multicolumn{4}{c}{textbf{Destination}}
& multirow{2.4}{*}{textbf{Supply}} \
cmidrule{2-5}
& 1 & 2 & 3 & 4 & \
midrule
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
midrule
textbf{Demand}
& d_1 & d_2 & d_3 & d_4 & T \
bottomrule
end{tabular}
end{table}
end{document}
edit: or you more prefer the following solution:
documentclass[12pt,fleqn]{article}
usepackage{diagbox}
usepackage{booktabs,
makecell, % <--- new
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
multirow{2}{*}{
diagbox{textbf{Source}}{textbf{Destination}}
}
& $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
& & & & & \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
which gives:
it's probably not difficult to guess which solution I prefer ...
add a comment |
up vote
1
down vote
It is quite possible with some raisebox
es, but I don't think it's so nice:
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl, makecell, caption}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|*{4}{>{$}c<{$}}|>{$}c<{$}|}
hline
diagbox[innerwidth =40mm, height =15mm]%,innerleftsep = 12pt
{raisebox{2.5ex}{textbf{Source}}}{raisebox{-0.5ex}{textbf{Destination}}} & raisebox{2.25ex}{$1$} & raisebox{2.25ex}{$2$} & raisebox{2.25ex}{$3$} & raisebox{2.25ex}{$4$} & raisebox{2.25ex}{textbf{Supply}} \
hline
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
hline
textbf{Demand} & d_1 & d_2 & d_3 & d_4 & T\
hline
end{tabular}
end{table}
end{document}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
meanwhile when you wait on desired solution, see if the following redesign of your table is acceptable to you:
documentclass[12pt,fleqn]{article}
%usepackage{pict2e} % not needed in this mwe
%usepackage{keyval} % not needed in this mwe
%usepackage{calc} % not needed in this mwe
%usepackage{fp} % not needed in this mwe
%usepackage{diagbox}
usepackage{booktabs,
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
caption[short caption]{long caption}
label{tab:table1}
centering
begin{tabular}{*{6}{>{$}c<{$}} }
toprule
multirow{2.4}{*}{textbf{Source}}
& multicolumn{4}{c}{textbf{Destination}}
& multirow{2.4}{*}{textbf{Supply}} \
cmidrule{2-5}
& 1 & 2 & 3 & 4 & \
midrule
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
midrule
textbf{Demand}
& d_1 & d_2 & d_3 & d_4 & T \
bottomrule
end{tabular}
end{table}
end{document}
edit: or you more prefer the following solution:
documentclass[12pt,fleqn]{article}
usepackage{diagbox}
usepackage{booktabs,
makecell, % <--- new
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
multirow{2}{*}{
diagbox{textbf{Source}}{textbf{Destination}}
}
& $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
& & & & & \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
which gives:
it's probably not difficult to guess which solution I prefer ...
add a comment |
up vote
2
down vote
meanwhile when you wait on desired solution, see if the following redesign of your table is acceptable to you:
documentclass[12pt,fleqn]{article}
%usepackage{pict2e} % not needed in this mwe
%usepackage{keyval} % not needed in this mwe
%usepackage{calc} % not needed in this mwe
%usepackage{fp} % not needed in this mwe
%usepackage{diagbox}
usepackage{booktabs,
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
caption[short caption]{long caption}
label{tab:table1}
centering
begin{tabular}{*{6}{>{$}c<{$}} }
toprule
multirow{2.4}{*}{textbf{Source}}
& multicolumn{4}{c}{textbf{Destination}}
& multirow{2.4}{*}{textbf{Supply}} \
cmidrule{2-5}
& 1 & 2 & 3 & 4 & \
midrule
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
midrule
textbf{Demand}
& d_1 & d_2 & d_3 & d_4 & T \
bottomrule
end{tabular}
end{table}
end{document}
edit: or you more prefer the following solution:
documentclass[12pt,fleqn]{article}
usepackage{diagbox}
usepackage{booktabs,
makecell, % <--- new
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
multirow{2}{*}{
diagbox{textbf{Source}}{textbf{Destination}}
}
& $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
& & & & & \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
which gives:
it's probably not difficult to guess which solution I prefer ...
add a comment |
up vote
2
down vote
up vote
2
down vote
meanwhile when you wait on desired solution, see if the following redesign of your table is acceptable to you:
documentclass[12pt,fleqn]{article}
%usepackage{pict2e} % not needed in this mwe
%usepackage{keyval} % not needed in this mwe
%usepackage{calc} % not needed in this mwe
%usepackage{fp} % not needed in this mwe
%usepackage{diagbox}
usepackage{booktabs,
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
caption[short caption]{long caption}
label{tab:table1}
centering
begin{tabular}{*{6}{>{$}c<{$}} }
toprule
multirow{2.4}{*}{textbf{Source}}
& multicolumn{4}{c}{textbf{Destination}}
& multirow{2.4}{*}{textbf{Supply}} \
cmidrule{2-5}
& 1 & 2 & 3 & 4 & \
midrule
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
midrule
textbf{Demand}
& d_1 & d_2 & d_3 & d_4 & T \
bottomrule
end{tabular}
end{table}
end{document}
edit: or you more prefer the following solution:
documentclass[12pt,fleqn]{article}
usepackage{diagbox}
usepackage{booktabs,
makecell, % <--- new
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
multirow{2}{*}{
diagbox{textbf{Source}}{textbf{Destination}}
}
& $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
& & & & & \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
which gives:
it's probably not difficult to guess which solution I prefer ...
meanwhile when you wait on desired solution, see if the following redesign of your table is acceptable to you:
documentclass[12pt,fleqn]{article}
%usepackage{pict2e} % not needed in this mwe
%usepackage{keyval} % not needed in this mwe
%usepackage{calc} % not needed in this mwe
%usepackage{fp} % not needed in this mwe
%usepackage{diagbox}
usepackage{booktabs,
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
caption[short caption]{long caption}
label{tab:table1}
centering
begin{tabular}{*{6}{>{$}c<{$}} }
toprule
multirow{2.4}{*}{textbf{Source}}
& multicolumn{4}{c}{textbf{Destination}}
& multirow{2.4}{*}{textbf{Supply}} \
cmidrule{2-5}
& 1 & 2 & 3 & 4 & \
midrule
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
midrule
textbf{Demand}
& d_1 & d_2 & d_3 & d_4 & T \
bottomrule
end{tabular}
end{table}
end{document}
edit: or you more prefer the following solution:
documentclass[12pt,fleqn]{article}
usepackage{diagbox}
usepackage{booktabs,
makecell, % <--- new
multirow, % <--- new
tabularx}
usepackage[table]{xcolor}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|cccc|c|}
hline
multirow{2}{*}{
diagbox{textbf{Source}}{textbf{Destination}}
}
& $1$ & $2$ & $3$ & $4$ & textbf{Supply} \
& & & & & \
hline
$1$ & $c_{11}$ & $c_{12}$ & $c_{13}$ & $c_{14}$ & $s_1$ \
$2$ & $c_{21}$ & $c_{22}$ & $c_{23}$ & $c_{24}$ & $s_2$ \
$3$ & $c_{31}$ & $c_{32}$ & $c_{33}$ & $c_{34}$ & $s_3$ \
$4$ & $c_{41}$ & $c_{42}$ & $c_{43}$ & $c_{44}$ & $s_4$ \
hline
textbf{Demand} & $d_1$ & $d_2$ & $d_3$ & $d_4$ & $T$\
hline
end{tabular}
end{table}
end{document}
which gives:
it's probably not difficult to guess which solution I prefer ...
edited 2 hours ago
answered 2 hours ago
Zarko
117k865155
117k865155
add a comment |
add a comment |
up vote
1
down vote
It is quite possible with some raisebox
es, but I don't think it's so nice:
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl, makecell, caption}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|*{4}{>{$}c<{$}}|>{$}c<{$}|}
hline
diagbox[innerwidth =40mm, height =15mm]%,innerleftsep = 12pt
{raisebox{2.5ex}{textbf{Source}}}{raisebox{-0.5ex}{textbf{Destination}}} & raisebox{2.25ex}{$1$} & raisebox{2.25ex}{$2$} & raisebox{2.25ex}{$3$} & raisebox{2.25ex}{$4$} & raisebox{2.25ex}{textbf{Supply}} \
hline
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
hline
textbf{Demand} & d_1 & d_2 & d_3 & d_4 & T\
hline
end{tabular}
end{table}
end{document}
add a comment |
up vote
1
down vote
It is quite possible with some raisebox
es, but I don't think it's so nice:
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl, makecell, caption}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|*{4}{>{$}c<{$}}|>{$}c<{$}|}
hline
diagbox[innerwidth =40mm, height =15mm]%,innerleftsep = 12pt
{raisebox{2.5ex}{textbf{Source}}}{raisebox{-0.5ex}{textbf{Destination}}} & raisebox{2.25ex}{$1$} & raisebox{2.25ex}{$2$} & raisebox{2.25ex}{$3$} & raisebox{2.25ex}{$4$} & raisebox{2.25ex}{textbf{Supply}} \
hline
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
hline
textbf{Demand} & d_1 & d_2 & d_3 & d_4 & T\
hline
end{tabular}
end{table}
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
It is quite possible with some raisebox
es, but I don't think it's so nice:
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl, makecell, caption}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|*{4}{>{$}c<{$}}|>{$}c<{$}|}
hline
diagbox[innerwidth =40mm, height =15mm]%,innerleftsep = 12pt
{raisebox{2.5ex}{textbf{Source}}}{raisebox{-0.5ex}{textbf{Destination}}} & raisebox{2.25ex}{$1$} & raisebox{2.25ex}{$2$} & raisebox{2.25ex}{$3$} & raisebox{2.25ex}{$4$} & raisebox{2.25ex}{textbf{Supply}} \
hline
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
hline
textbf{Demand} & d_1 & d_2 & d_3 & d_4 & T\
hline
end{tabular}
end{table}
end{document}
It is quite possible with some raisebox
es, but I don't think it's so nice:
documentclass[12pt,fleqn]{article}
usepackage{pict2e}
usepackage{keyval}
usepackage{calc}
usepackage{fp}
usepackage{diagbox}
usepackage{booktabs}
usepackage{tabularx,colortbl, makecell, caption}
begin{document}
begin{table}[h!]
centering
caption[caption]{Table 1}
label{tab:table1}
begin{tabular}{|l|*{4}{>{$}c<{$}}|>{$}c<{$}|}
hline
diagbox[innerwidth =40mm, height =15mm]%,innerleftsep = 12pt
{raisebox{2.5ex}{textbf{Source}}}{raisebox{-0.5ex}{textbf{Destination}}} & raisebox{2.25ex}{$1$} & raisebox{2.25ex}{$2$} & raisebox{2.25ex}{$3$} & raisebox{2.25ex}{$4$} & raisebox{2.25ex}{textbf{Supply}} \
hline
1 & c_{11} & c_{12} & c_{13} & c_{14} & s_1 \
2 & c_{21} & c_{22} & c_{23} & c_{24} & s_2 \
3 & c_{31} & c_{32} & c_{33} & c_{34} & s_3 \
4 & c_{41} & c_{42} & c_{43} & c_{44} & s_4 \
hline
textbf{Demand} & d_1 & d_2 & d_3 & d_4 & T\
hline
end{tabular}
end{table}
end{document}
answered 2 hours ago
Bernard
163k768192
163k768192
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f462761%2fhow-to-position-text-in-the-top-of-all-columns-in-the-upper-row-of-a-table-diag%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
please be so kind ans extend your code snippet to complete small document, which we can copy and test as it is in our computers! now wee need to gues which package you use for this table etc ...
– Zarko
3 hours ago
@Zarko Done, I use relatively many packages so it was kind of difficult to select the useful ones, but I think this represents the problem well.
– Anna
3 hours ago