Graphics, Figures & TablesMisplaced \noalign: custom infobox with nested tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kirik
Posts: 4
Joined: Tue Jul 20, 2010 11:43 am

Misplaced \noalign: custom infobox with nested tabular

Post by kirik »

Hi,

I have decided to have some infoboxes in my thesis paper, and after some searching and tweaking, I came up with the code below. While I get results, the execution still terminates with an "Misplaced \noalign {" error, which I am not sure where it originates from.

Would appreciate any help on the matter! (Btw any tips on how to make the infobox better is also warmly welcome)

Code: Select all

\documentclass[11pt,a4paper,twoside]{article}
% skipped the most likely unrelated preamble.. 

% to fix underfull hbox & overfull vbox 
  \tolerance 1414
  \hbadness 1414
  \emergencystretch 1.5em
  \hfuzz 0.3pt
  \widowpenalty=10000
  \vfuzz \hfuzz
  \raggedbottom

% info-boxes
\definecolor{MyGray}{rgb}{0.95,0.95,0.95}
\makeatletter\newenvironment{graybox}{%
    \begin{center}
        \begin{lrbox}{\@tempboxa}\begin{minipage}{0.8\textwidth}}{\end{minipage}\end{lrbox}%
	\colorbox{MyGray}{\usebox{\@tempboxa}}
    \end{center}
}\makeatother

Code: Select all

\begin{graybox}
  \begin{tabular}[h]{l}
    \textbf{Parameters used}  \\ \hline
    \parbox{0.9\textwidth}{%
     \begin{singlespace}
      \begin{description}
      \item[P\textsubscript{sig}] some long text
      \item[P\textsubscript{f}] some long text 
      \item[P\textsubscript{tot}] some long text
      \item[P\textsubscript{rel}] some long text \\ \hline
      \item[n\textsubscript{sig}] some long text
      \item[$\bar{P}$] some long text
      \end{description}
     \end{singlespace}
}
    \end{tabular}
\end{graybox}

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: Misplaced \noalign: custom infobox with nested tabular

Post by Stefan Kottwitz »

Hi kirik,

welcome to the board!
The error is caused by \hline inside the \parbox argument. Remove this \hline and compile again, that error should be gone then.

Stefan
LaTeX.org admin
kirik
Posts: 4
Joined: Tue Jul 20, 2010 11:43 am

Misplaced \noalign: custom infobox with nested tabular

Post by kirik »

thanks Stefan!

I have noticed another problem with the infoboxes; when I put some text in alltt environment inside one of those boxes, the margins in the box are rather large on the top and bottom, while tiny on the sides. Any idea what might be the reason for that? Here's the code:

Code: Select all

\begin{graybox}
  \begin{alltt}
    \begin{singlespace}
      \begin{small}
###########################################################
### Parameter file  
###########################################################
###
### Input stream for the program (ex: '~/proteins.txt')
INPUT = /.../HL.xls
###
### Output folder
OUTPUT = 
###
### Significance threshold
SIG = 0.05
###
### Ratio threshold
REG = 
###
### (PEP) threshold 
PEP = 
###
### Coefficients 
ALPHA_1 = 0.4
ALPHA_2 = 0.2
ALPHA_3 = 0.2
ALPHA_4 = 0.2
K = 4
L = 0.25
###
      \end{small}
    \end{singlespace}
  \end{alltt}
\end{graybox}
Post Reply