## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Horizontal Line in tabbed Environment

Information and discussion about graphics, figures & tables in LaTeX documents.
teotjunk
Posts: 17
Joined: Fri Sep 19, 2008 5:28 pm

### Horizontal Line in tabbed Environment

This is my code.
\begin{tabbing}\hline\textbf{Alg}\=\textbf{orithm 1} Sampling from PG (1,z)\+\\

This is the error message I get.
Misplaced \noalign \hlineMisplaced \noalign \hlineYou can't use \hrule' here except with leaders \hlineMissing number, treated as zero \hlineIllegal unit of measure (pt inserted) \hline
Last edited by localghost on Wed Apr 17, 2013 11:22 am, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

Tags:

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am
Furthermore, just above the editing window (see attached screenshot), there are several bottons to help editing the post.

For example, when you have code, highlight it by pressing the "Code" botton.
Attachments
Editing window.
editing-window.jpg (66.23 KiB) Viewed 7797 times
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

teotjunk
Posts: 17
Joined: Fri Sep 19, 2008 5:28 pm
\documentclass[12pt]{report} %\usepackage \begin{document}  \begin{tabbing}\\\hline\textbf{Alg}\=\textbf{orithm 1} Sampling from PG (1,z)\+\\   \textbf{Input}: $z$ a positive real number\\\end{tabbing}\end{document}     

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
\hline is not meant for use in the {tabbing} environment. Internally it uses \noalign which cannot be used here and which is why you get the error. You could instead use a standard \rule:

\documentclass[12pt]{report} \begin{document} \begin{tabbing}\rule{\linewidth}{\arrayrulewidth}\\\textbf{Alg}\=\textbf{orithm 1} Sampling from $PG(1,z)$ \+ \\   \textbf{Input}: $z$ a positive real number\\\end{tabbing} \end{document}

You could also define a custom command \tabrule for this, maybe with an optional argument for the width:

\documentclass{article} \newcommand*\tabrule[1][]{%   \if\relax\detokenize{#1}\relax     \rule{\linewidth}{\arrayrulewidth}%   \else     \rule{#1}{\arrayrulewidth}%   \fi} \begin{document} \begin{tabbing}  \tabrule\\  \textbf{Alg}\=\textbf{orithm 1} Sampling from $PG(1,z)$ \+ \\    \textbf{Input}: $z$ a positive real number\\\end{tabbing} \end{document}`

tabbing.png (7 KiB) Viewed 7773 times

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim