Graphics, Figures & Tableshelp with multirow, wrapping and centering text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sarju115
Posts: 4
Joined: Fri May 28, 2010 12:01 am

help with multirow, wrapping and centering text

Post by sarju115 »

Hi all,
I'm relatively new to Latex and am trying to create this table:

{
\renewcommand{\arraystretch}{1.2}
\begin{table}[htbp]
\centering
\caption{Header file of electronic database for permit vehicles}
\begin{tabular}{|m{0.6in}|c|c|p{2.3in}|}
\hline
\bf Column No. & \bf Field/Parameter & \bf Units & \bf {\centering Description} \\
\hline
1 & ID & Integer & Permit Application ID \\
\hline
2 & Company Name & Text & Name of the Trucking Company \\
\hline
3 & Route & Text & Trip Route \\
\hline
4 & Initials & Text & Initials of the Permit Reviewer \\
\hline
5 & Year In & \multirow{6}{*}{Integer} & \multirow{6}*{Time of Permit Application} \\\cline{1-2}

6 & Month In \\ \cline{1-2}

7 & Day In \\ \cline{1-2}

8 & Hour In \\ \cline{1-2}

9 & Minute In \\ \cline{1-2}

10 & Second In \\
\hline

11 & Year Out & \multirow{6}{*}{Integer} & \multirow{6}*{Time of Permit Issuance} \\\cline{1-2}

12 & Month Out \\\cline{1-2}

13 & Day Out \\ \cline{1-2}

14 & Hour Out \\\cline{1-2}

15 & Minute Out \\\cline{1-2}

16 & Second Out \\
\hline
17 & Agency & Integer & Agency Issuing Permit-DMV=1, DOT=2 \\
\hline
18 & Origin & Integer & Origin of Trip \\
\hline
19 & Destination & Integer & Destination of Trip \\
\hline
20 & Submittal & Integer & Number of Submittals \\
\hline
21 & Height & Integer & Height of Vehicle \\
\hline
22 & GVW & Integer & Gross Vehicular Weight \\
\hline
23 & Width & Integer & Width of Vehicle \\
\hline
24 & Length & Integer & Length of Vehicle \\
\hline
25 & NAX & Integer & Number of Axles \\
\hline
26 & AXW1 & Integer & Axle Weight of 1$^{st}$ Axle \\
\hline
27 & AXS1 & Integer & Axle Spacing of 1$^{st}$ Axle \\
\hline
28 & AXW2 & Integer & Axle Weight of 2$^{nd}$ Axle \\
\hline
29 & AXS2 & Integer & Axle Spacing of 2$^{nd}$ Axle \\
\hline
\ldots & \ldots & \ldots & \ldots \\
\hline
\ldots & \ldots & \ldots & \ldots \\
\hline
\ldots & \ldots & \ldots & \ldots \\
\hline
\end{tabular}
\label{table2}
\end{table}
}

The problem is that, the vertical bars for cells included in multirow function is not displayed properly; only the first lines appears. Also for the first column, I tried to center it vertically using m{} in the tabular argument, but didnt work. Can someone also tell me a better way to wrap text than the not so aesthetic p{}.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

help with multirow, wrapping and centering text

Post by localghost »

Always post full examples [1]. The lack of a full example is the reason why haven't got any reply yet.

Don't forget to insert all columns for all lines. Compare the code below with yours.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{array,multirow}

\begin{document}
  \begin{table}[!ht]
    \renewcommand{\arraystretch}{1.2}
    \caption{Header file of electronic database for permit vehicles}\label{tab:header}
    \centering
    \begin{tabular}{|m{0.6in}|c|c|p{2.3in}|} \hline
      \textbf{Column No.} & \textbf{Field/Parameter} & \textbf{Units} & \textbf{ Description} \\ \hline
      1 & ID & Integer & Permit Application ID \\ \hline
      2 & Company Name & Text & Name of the Trucking Company \\ \hline
      3 & Route & Text & Trip Route \\ \hline
      4 & Initials & Text & Initials of the Permit Reviewer \\ \hline
      5 & Year In & \multirow{6}{*}{Integer} & \multirow{6}*{Time of Permit Application} \\ \cline{1-2}
      6 & Month In & & \\ \cline{1-2}
      7 & Day In & & \\ \cline{1-2}
      8 & Hour In & & \\ \cline{1-2}
      9 & Minute In & & \\ \cline{1-2}
      10 & Second In & & \\ \hline
      11 & Year Out & \multirow{6}{*}{Integer} & \multirow{6}*{Time of Permit Issuance} \\ \cline{1-2}
      12 & Month Out & & \\ \cline{1-2}
      13 & Day Out & & \\ \cline{1-2}
      14 & Hour Out & & \\ \cline{1-2}
      15 & Minute Out & & \\ \cline{1-2}
      16 & Second Out & & \\ \hline
      17 & Agency & Integer & Agency Issuing Permit-DMV=1, DOT=2 \\ \hline
      18 & Origin & Integer & Origin of Trip \\ \hline
      19 & Destination & Integer & Destination of Trip \\ \hline
      20 & Submittal & Integer & Number of Submittals \\ \hline
      21 & Height & Integer & Height of Vehicle \\ \hline
      22 & GVW & Integer & Gross Vehicular Weight \\ \hline
      23 & Width & Integer & Width of Vehicle \\ \hline
      24 & Length & Integer & Length of Vehicle \\ \hline
      25 & NAX & Integer & Number of Axles \\ \hline
      26 & AXW1 & Integer & Axle Weight of 1$^{st}$ Axle \\ \hline
      27 & AXS1 & Integer & Axle Spacing of 1$^{st}$ Axle \\ \hline
      28 & AXW2 & Integer & Axle Weight of 2$^{nd}$ Axle \\ \hline
      29 & AXS2 & Integer & Axle Spacing of 2$^{nd}$ Axle \\ \hline
      \ldots & \ldots & \ldots & \ldots \\ \hline
      \ldots & \ldots & \ldots & \ldots \\ \hline
      \ldots & \ldots & \ldots & \ldots \\ \hline
    \end{tabular}
  \end{table}
\end{document}
I can't comprehend the issue with the vertical centering in the header. It works fine for me with the above code. The tabularx package offers other structures for line wrapping in table cells.

[1] View topic: Avoidable mistakes


Best regards and welcome to the board
Thorsten
sarju115
Posts: 4
Joined: Fri May 28, 2010 12:01 am

Re: help with multirow, wrapping and centering text

Post by sarju115 »

thanx for the rep...was a rookie mistake..
btw, i've found that tables made in gnumeric can be saved as latex code and with minimum tweaks produce desirable results..
Post Reply