Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was trying to take a dig at LaTeX and wanted to write a resume in it, but before I start writing the resume I wanted to learn the quintessential of latex. While trying to create a line I encountered some issues.

When I draw a line beneath or above the text , while generating pdf (using pdflatex) the lines doesn't appear in the same page , rather lines appear in a new page and text in different.

Here is the code

%Trying out rules in Latex

\documentclass{article}
\begin{document}

\title{Rules in \LaTeX{}}
\line(1,0){250}
\author{Shashwat Pant}
\maketitle


\end{document}

If I use \hrulefill or \line I only get line in the document but no text if I use Texmaker, however if I compile it using pdflatex I get the line in the front page and text in other. So how do I actually draw a line horizontal line touching each end of the sheet yet stay beneath some text, like a separator.

share|improve this question

migrated from stackoverflow.com Aug 19 '12 at 16:04

This question came from our site for professional and enthusiast programmers.

1  
\line is supposed to be only used in a picture environment. –  Martin Schröder Aug 19 '12 at 20:12
add comment

1 Answer 1

up vote 4 down vote accepted

Typesetting the title is a job for the \maketitle command, which relies on the internal command \@maketitle, so you have to modify this one:

\documentclass{article}

\makeatletter
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em
  \begin{center}
  \let \footnote \thanks
    {\LARGE \@title \par}
    \vskip 1.5em
  %%% Addition
    \hrule
    \vskip 1.5em
  %%% End addition
    {\large
      \lineskip .5em
      \begin{tabular}[t]{c}
        \@author
      \end{tabular}\par}
    \vskip 1em
    {\large \@date}
  \end{center}
  \par
  \vskip 1.5em}
\makeatother

\begin{document}

\title{Rules in \LaTeX{}}
\author{Shashwat Pant}
\maketitle


\end{document}

enter image description here

share|improve this answer
    
Thanks for the detailed explanation, but since i am a beginner I don't understand some of the stuff. What if i want to enter a line beneath a normal text and not in the title ? What then ? Also which document class should I use for creating resume since text in the article class appears to be centered . –  Shashwat Aug 25 '12 at 16:44
    
@Shashwat This is a very special case; for rules in the text there's \rule. –  egreg Aug 25 '12 at 17:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.