GeneralHorizontal line?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ck9
Posts: 7
Joined: Tue May 19, 2009 10:26 am

Horizontal line?

Post by ck9 »

Hi
How can I create horizontal lines like this?

What is your opinion of LyX? ______________________________________________
_________________________________________________________________________
_________________________________________________________________________

Do you like Weetabix? ____________________________________________________
_________________________________________________________________________

etc.

I guess it can be done manually with the /line command, but it is there a more automatic way? (e.g. /dolines {x} - where x is the number of lines)

Thanks

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Horizontal line?

Post by gmedina »

Hi,

you can create those lines "manually" using \hrulefill:

Code: Select all

\documentclass{article}

\begin{document}

text text \hrulefill

\noindent\hrulefill

\noindent\hrulefill

\end{document}
The exam class, for example, allows you to automate this process and provides many other features that you could be interested in.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ck9
Posts: 7
Joined: Tue May 19, 2009 10:26 am

Re: Horizontal line?

Post by ck9 »

Thanks a lot. Works great however it's not creating the line on blank lines. Any ideas? Inserting a horizontal space doesn't do it either.

\documentclass{article}

\begin{document}

text text (this works fine) \hrulefill

\noindent\hrulefill (this doesn't work)

. \noindent\hrulefill (this works as there is a character before the command)

\end{document}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Horizontal line?

Post by gmedina »

ck9 wrote:Thanks a lot. Works great however it's not creating the line on blank lines. Any ideas? Inserting a horizontal space doesn't do it either.

\documentclass{article}

\begin{document}

text text (this works fine) \hrulefill

\noindent\hrulefill (this doesn't work)

. \noindent\hrulefill (this works as there is a character before the command)

\end{document}
I don't understand what is not working exactly. The code that I posted produces three horizontal rules; I attach the resulting pdf file. Are you getting something different?
Attachments
test.pdf
(10.74 KiB) Downloaded 1653 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ck9
Posts: 7
Joined: Tue May 19, 2009 10:26 am

Re: Horizontal line?

Post by ck9 »

Yes it works. In LyX I was using it within an enumerate list (i.e. 1. 2. 3.) and used a ctrl-space followed by \hrulefill. That only produces the horizontal line when the line has something already. On a standard line it works just like you said. Thanks again.
Post Reply