1

I am showing a comaprison in a table. As shown in the LaTeX code below, the information I specify in the second column, second row is a bit long. When I compile the code, that information in the table does not show up completely. The information is not split across lines either.

My question is, how to show the information in the second row second column as whole, without losing it.

\begin{table}[h]
\caption{Performance After Post Filtering} % title name of the table
\centering % centering table
\begin{tabular}{l c c rrrrrrr} % creating 10 columns
\hline\hline % inserting double-line

&InsecureRFComm &RFComm 
\\ [0.5ex]
\hline % inserts single-line
% Entering 1st row
&RFComm Socket &RFComm Socket\\[-1ex]
\raisebox{1.5ex}{BT-Socket Type} 
% Entering 2nd row
&No authenticated link key Socket &Authenticated link key\\[-1ex]
\raisebox{1.5ex}{Communication channel} 
% Entering 3rd row
& &soft & 1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Remote Device} \\
\raisebox{1.5ex}{For BT-Serial Port} \\
\raisebox{1.5ex}{For Peer-Peer Apps} \\
\raisebox{1.5ex}{Initiating The Outgoing Connection} \\

% [1ex] adds vertical space
\hline % inserts single-line
\end{tabular}
\label{tab:PPer}
\end{table}
  • Your problem is the tabular exceeds the margins and so it runs off the right. You can reformulate your table representation, or you could present in landscape mode, or you could wrap the tabular in a \makebox[\textwidth]{...}. This latter choice still violates margin width, but at least would center the content with respect to the text area, so as to fit on a typical piece of paper. – Steven B. Segletes May 9 '16 at 10:27
  • would you please provide an example – Elpharaoh May 9 '16 at 11:15
3

In response to the OP's request to provide an example, I first show here how to wrap the tabular in a \makebox to provide a centered (albeit oversized) table.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{table}[h]
\caption{Performance After Post Filtering} % title name of the table
\centering % centering table
\makebox[\textwidth]{\begin{tabular}{l c c rrrrrrr} % creating 10 columns
\hline\hline % inserting double-line

&InsecureRFComm &RFComm 
\\ [0.5ex]
\hline % inserts single-line
% Entering 1st row
&RFComm Socket &RFComm Socket\\[-1ex]
\raisebox{1.5ex}{BT-Socket Type} 
% Entering 2nd row
&No authenticated link key Socket &Authenticated link key\\[-1ex]
\raisebox{1.5ex}{Communication channel} 
% Entering 3rd row
& &soft & 1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Remote Device} \\
\raisebox{1.5ex}{For BT-Serial Port} \\
\raisebox{1.5ex}{For Peer-Peer Apps} \\
\raisebox{1.5ex}{Initiating The Outgoing Connection} \\

% [1ex] adds vertical space
\hline % inserts single-line
\end{tabular}}
\label{tab:PPer}
\end{table}
\lipsum[1]
\end{document}

enter image description here

As to the landscape alternative, there is this with pdflscape package:

\documentclass{article}
\usepackage{lipsum,pdflscape}
\begin{document}
\begin{landscape}
\begin{table}[p]
\caption{Performance After Post Filtering} % title name of the table
\centering % centering table
\makebox[\textwidth]{\begin{tabular}{l c c rrrrrrr} % creating 10 columns
\hline\hline % inserting double-line

&InsecureRFComm &RFComm 
\\ [0.5ex]
\hline % inserts single-line
% Entering 1st row
&RFComm Socket &RFComm Socket\\[-1ex]
\raisebox{1.5ex}{BT-Socket Type} 
% Entering 2nd row
&No authenticated link key Socket &Authenticated link key\\[-1ex]
\raisebox{1.5ex}{Communication channel} 
% Entering 3rd row
& &soft & 1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Remote Device} \\
\raisebox{1.5ex}{For BT-Serial Port} \\
\raisebox{1.5ex}{For Peer-Peer Apps} \\
\raisebox{1.5ex}{Initiating The Outgoing Connection} \\

% [1ex] adds vertical space
\hline % inserts single-line
\end{tabular}}
\label{tab:PPer}
\end{table}
\end{landscape}
\lipsum[1]
\end{document}

enter image description here

  • thanks for your answers..regarding the 1st answer the problem remains but "reversed" in the sense of, the text on the right side is complete but on the left side is truncated and cant be displayed...regarding the 2nd answer, it compiles with no error but i get empty page – Elpharaoh May 10 '16 at 9:50
  • @Elpharaoh In the first case, it sounds like your left and right margins are non-symmetric. In that case, get rid of the \centering after the \caption and specify a larger-width \makebox as in \makebox[1.1\textwidth]{...}. That will result in the figure be shifted to the right slightly. Change the value 1.1 to suit your need. – Steven B. Segletes May 10 '16 at 10:00
  • @Elpharaoh In the second case, I'm not exactly sure what the issue is. Normally getting an extra blank page would mean the table was too wide for the page. Perhaps try changing the \makebox width from \textwidth to 0pt and see if that makes a difference. There is a lot you have not provided about your situation, like the document class, the packages, etc. It makes it much harder to diagnose. – Steven B. Segletes May 10 '16 at 10:03
  • 1
    @Elpharaoh One other option for either case is to specify \small or \footnotesize immediately after the \begin{table} specification. This will shrink the font, just of the table content itself. – Steven B. Segletes May 10 '16 at 10:06

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.