GeneralWriting a horizontal line in a minipage

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
csmgroup
Posts: 25
Joined: Sat Jul 17, 2010 6:58 pm

Writing a horizontal line in a minipage

Post by csmgroup »

I need to draw a line inside a minipage.
I used \hline for the purpose, but I get the following error.

Code: Select all

! Misplaced \noalign.
<recently read> \noalign 
                         
l.29 \vskip0.3em\hline
                      \vskip1em
? 
What might be wrong? Or, is there other way to draw the line in a minipage?

Code: Select all

\documentclass{article}
\usepackage{tikz}
\newcommand{\clj}{\textcolor{blue}{\textsc{clojure}}}

\title{Week 31, August$^{1st}$ 2010}
\newlength{\RoundedBoxWidth}
\newsavebox{\GrayRoundedBox}
\newenvironment{GrayBox}[1][\dimexpr\textwidth-4.5ex]%
   {\setlength{\RoundedBoxWidth}{\dimexpr#1}
    \begin{lrbox}{\GrayRoundedBox}
       \begin{minipage}{\RoundedBoxWidth}}%
   {   \end{minipage}
    \end{lrbox}
    \begin{center}
    \begin{tikzpicture}%
       \draw node[draw=black,fill=black!10,rounded corners,%
             inner sep=2ex,text width=\RoundedBoxWidth]%
             {\usebox{\GrayRoundedBox}};
    \end{tikzpicture}
    \end{center}}

\begin{document}
hello\footnote{experiment}
%\newcounter{\myfootnote}
%\setcounter{\myfootnote}{\value{footnote}}
\vskip2ex
\begin{GrayBox}[1.2\textwidth]
{\LARGE How to use external \clj\ code}
\vskip0.3em\hline\vskip1em
The caller uses `use' to use \verb|CLASSPATH/hello.clj|. Now, it's OK to call
the (hi).%\footnotemark[\value{\myfootnote}]

\end{GrayBox}
hello\footnote{experiment again}
\end{document}
Last edited by csmgroup on Tue Aug 03, 2010 7:02 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Writing a horizontal line in a minipage

Post by torbjorn t. »

Try \hrule in stead.
csmgroup
Posts: 25
Joined: Sat Jul 17, 2010 6:58 pm

Re: Writing a horizontal line in a minipage

Post by csmgroup »

\hrule works fine. Thanks.
Post Reply