Hello everybody
i have to create a chart in latex and hope that you can help me.
the chart has to look like:
how can i realise that?
Math & Science ⇒ create a chart
NEW: TikZ book now 40% off at Amazon.com for a short time.

create a chart
Hi micheal_b,
The way I would do it would be to imagine that every square on the paper in your example represents a column or row then only put in lines when appropriate.
You will need to use \multicolumn and \cline commands. I'm busy at the moment so have only done a small example to get you started. If you don't understand anything please ask.
I found the slashbox package through google and it can be downloaded here. It isn't perfect but is a good start
http://www.tex.ac.uk/tex-archive/macros ... /slashbox/
The way I would do it would be to imagine that every square on the paper in your example represents a column or row then only put in lines when appropriate.
You will need to use \multicolumn and \cline commands. I'm busy at the moment so have only done a small example to get you started. If you don't understand anything please ask.
Code: Select all
\documentclass{article}
\usepackage{slashbox,multirow}
\begin{document}
\begin{tabular}{|ccc|}
\hline
\multicolumn{1}{|c|}{A}&&\\
\cline{1-1}
&$x_{12}$&\\
&&\\
\hline
\multicolumn{3}{|c|}{\multirow{3}{*}{\backslashbox{20}{20}}}\\ && \\ &&\\
\hline
\end{tabular}
\end{document}
http://www.tex.ac.uk/tex-archive/macros ... /slashbox/
create a chart
hi php1ic!
thank you for the quick answer.
i have no problems to add new boxes in one way. But how can i add new splits?
My code looks now like that:
Additionally, is there a possibility to pick e.g. the x_11 to the head of the box so that the x_11 are beside the number?
thank you for the quick answer.
i have no problems to add new boxes in one way. But how can i add new splits?
My code looks now like that:
Code: Select all
\documentclass{article}
\usepackage{slashbox,multirow}
\begin{document}
\begin{tabular}{|ccc|}
\hline
\multicolumn{1}{|c}{}&&\\
&$B_1$&\\
&&\\
\hline
\hline
\multicolumn{1}{|c|}{2}&&\\
\cline{1-1}
&$x_{11}$&\\
&&\\
\hline
\multicolumn{1}{|c|}{2}&&\\
\cline{1-1}
&$x_{21}$&\\
&&\\
\hline
\multicolumn{1}{|c|}{1}&&\\
\cline{1-1}
&$x_{31}$&\\
&&\\
\hline
\multicolumn{1}{|c}{}&&\\
&$10$&\\
&&\\
\hline
\end{tabular}
\end{document}
create a chart
I assume by splits you mean columns. To do that you need to put more arguments when you start the tabular environment
each letter 'c' represents a column containing centered text (r - right aligned, l - left). The code below almost reproduces the table you want but maths mode cannot be used with \multirow so you may want to continue constructing the table by extending the code you posted.
to put x_11 at the top for your example, simply move it up one cell ie
Code: Select all
\begin{tabular}{|ccc|ccc|ccc|}
Code: Select all
\begin{tabular}{cc|cc|cc|ccc}
&&\multicolumn{2}{|c|}{B{\tiny 1}}&\multicolumn{2}{|c|}{B{\tiny 2}}&\multicolumn{3}{|c}{a{\tiny i}}\\
\hline
\multicolumn{2}{c|}{\multirow{2}{*}{A{\tiny 1}}}&\multicolumn{1}{|c|}{1}&$x_{11}$&\multicolumn{1}{|c|}{2}&$x_{12}$&\multicolumn{3}{c}{\multirow{2}{*}{ 10 }}\\
\cline{3-3}\cline{5-5}
&&&&&&\\
\hline
\multicolumn{2}{c|}{\multirow{2}{*}{A{\tiny 2}}}&\multicolumn{1}{|c|}{3}&$x_{21}$&\multicolumn{1}{|c|}{4}&$x_{22}$&\multicolumn{3}{c}{\multirow{2}{*}{ 10 }}\\
\cline{3-3}\cline{5-5}
&&&&&&\\
\hline
\multicolumn{2}{c|}{\multirow{2}{*}{b{\tiny i}}}&\multicolumn{2}{c|}{\multirow{2}{*}{10}}&\multicolumn{2}{c|}{\multirow{2}{*}{10}}&\multicolumn{3}{c}{\multirow{2}{*}{\backslashbox{20}{20}}}\\
&&&&&\\
\end{tabular}
Code: Select all
\hline
\multicolumn{1}{|c|}{2}&$x_{11}$&\\
\cline{1-1}
&&\\
&&\\
\hline
Re: create a chart
Yes you are right, i mean columns. Well thank you very much for your help. I have extend the code for another example and it looks great. 
