I want to create a table like this using LatexI need to do a table as in Figure

My code is, but I do not know how can make the second and third row in a table?

\begin {table}[ ]
\caption {The available bandwidth is divided into PRBs}          
\label{tab:The available bandwidth is divided into PRBs} 

\begin{tabular}{| c | c |c |c |c |c |c |} 
 Bandwith & & & & & & \\ 
 (MHz) & 1.25 & 2.5 & 5.0 & 10.0 & 15.0& 20.0\\ 
 Subcarrier   & & & & & & \\   
 bandwidth (kHz)  & & & & & & \\  

 Physical resource block   & & & & & & \\ 
 (PRBs) bandwidth (kHz)   & & & & & & \\  
 Number of available &   &   &   &   &   &  \\ 
 PRBs & 6 & 12 & 25 & 50 & 75 & 100\\ 
 \end {table}

Do you have any ideas how to tex this layout? Thanks a lot

  • 1
    Welcome to the site. WHat have you tried so far? Post some code. – Steven B. Segletes May 11 '17 at 14:11
  • @StevenB.Segletes Thanks a lot for your comment. I added the code again. But I do not know how can I write the second and third row. Do you have any ideas for this problem? Thanks – user3727281 May 11 '17 at 14:23
  • @user3727281: Please read an introductory text on LaTeX: It will show you the possibility of \multicolumn{6}{c|}{15} most likely in the second and similar in the 3rd row – user31729 May 11 '17 at 14:29

I don't know what exactly is your problem with typesetting this table in LaTeX, but I tried to reproduce all the features of your example. This code:




    Bandwidth (MHz) & 1.25 & 2.5 & 5.0 & 10.0 & 15.0 & 20.0 \\
    Subcarrier bandwidth (kHz) & \multicolumn{6}{c|}{15} \\
    Physical resource block (PRB) bandwidth (kHz) & \multicolumn{6}{c|}{180} \\
    Number of available PRBs & 6 & 12 & 25 & 50 & 75 & 100 \\


compiles to this table:

enter image description here

Some notes on the commands I used:

  • In the first column, you want to have central alignment, but at the same time automatically wrap in case the lines get too long. I follow this answer in defining a new column type C that gets a width (like in C{5cm}) but is centrally aligned. The same column type I use for the other columns, to have the numbers centered but with a fixed width.
  • To extend a single cell over several columns, I use the \multicolumn command. It takes as a first argument the number of columns that should be spanned, as a second the cell types and vertical lines (here, I choose centered and a closing vertical line - the opening vertical line is produced by the first column), and as a third the cell content.
  • To introduce a larger vertical spacing between the horizontal lines and the text in the cells, I redefine the arraystretch to factor 2.0, by \renewcommand{\arraystretch}{2.0}.
  • Edit: I included the very good hint of JiyuuSensei: Using >{\bfseries} before the column type in the argument of tabular typesets all cells in the first column bold-faced, so I don't need to insert that manually in every row.

I hope that helps.

  • @Tiuri I was having trouble getting my tables to work as intended yesterday, and I think the newcolumn is what I needed. Your answer is both clear and concise, and although I didn't ask the question I also appreciate the answer. – Jim Schubert May 11 '17 at 14:35
  • 1
    Deleted my answer as @Tiuri beat me to it :). I do recommend using a column-based text boldness for the first column. You can add >{\bfseries} in front of the C in |C{5cm}| to make all cell contents bold in that column: |>{\bfseries}C{5cm}|. Something that really helps when there are many more rows than this. Then you don't need to have \textbf{} in every row. – JiyuuSensei May 11 '17 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.