LaTeX forum ⇒ Graphics, Figures & TablesHorizontal 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

Postby teotjunk » Wed Apr 17, 2013 5:05 am

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

This is the error message I get.
  1. Misplaced \noalign \hline
  2. Misplaced \noalign \hline
  3. You can't use `\hrule' here except with leaders \hline
  4. Missing number, treated as zero \hline
  5. Illegal 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:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Apr 17, 2013 7:42 am

Please post a compilable working minimal example. This way it's easier for us to help you. Your case is like showing the mechanic the doorhandle of your car, asking him why the car won't drive. Please follow the link and help us to help you.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Postby svend_tveskaeg » Wed Apr 17, 2013 10:52 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.jpg
Editing window.
editing-window.jpg (66.23 KiB) Viewed 7639 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

Postby teotjunk » Thu Apr 18, 2013 9:21 am

  1. \documentclass[12pt]{report}
  2.  
  3. %\usepackage
  4.  
  5. \begin{document}
  6.  
  7.  
  8. \begin{tabbing}\\
  9. \hline
  10. \textbf{Alg}\=\textbf{orithm 1} Sampling from PG (1,z)\+\\
  11. \textbf{Input}: $z$ a positive real number\\
  12. \end{tabbing}
  13. \end{document}
  14.  
  15.  
  16.  
  17.  
  18.  

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Thu Apr 18, 2013 11:35 am

\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:

  1. \documentclass[12pt]{report}
  2.  
  3. \begin{document}
  4.  
  5. \begin{tabbing}
  6. \rule{\linewidth}{\arrayrulewidth}\\
  7. \textbf{Alg}\=\textbf{orithm 1} Sampling from $PG(1,z)$ \+ \\
  8. \textbf{Input}: $z$ a positive real number\\
  9. \end{tabbing}
  10.  
  11. \end{document}


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

  1. \documentclass{article}
  2.  
  3. \newcommand*\tabrule[1][]{%
  4. \if\relax\detokenize{#1}\relax
  5. \rule{\linewidth}{\arrayrulewidth}%
  6. \else
  7. \rule{#1}{\arrayrulewidth}%
  8. \fi
  9. }
  10.  
  11. \begin{document}
  12.  
  13. \begin{tabbing}
  14. \tabrule\\
  15. \textbf{Alg}\=\textbf{orithm 1} Sampling from $PG(1,z)$ \+ \\
  16. \textbf{Input}: $z$ a positive real number\\
  17. \end{tabbing}
  18.  
  19. \end{document}


tabbing.png
tabbing.png (7 KiB) Viewed 7615 times


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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests