Document ClassesI can't get titling package to work

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
ajnabi
Posts: 10
Joined: Mon Jan 29, 2007 1:09 am

I can't get titling package to work

Post by ajnabi »

Can someone please point me in the right direction with this titling package?

I have no idea how to make it work. All I'm trying to do, to start with, is make a title with a line above it and a line below it.

I know in this example I can do this:

Code: Select all

\title{This is the pretitle\\
This is the title\\
This is the posttitle}\maketitle
but I need to get the titling package working.

This is what I've tried.

Code: Select all


%% LyX 1.4.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{titling}

\begin{document}
\pretitle{this is the pretitle}

\title{this is the title}

\posttitle{This is the post titilte}
\maketitle
\end{document}
Thank you,
Frank

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

I can't get titling package to work

Post by gmedina »

Hi ajnabi,
Try something like this:

Code: Select all

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{titling}

\pretitle{\noindent\rule{\linewidth}{2pt}\begin{center}\LARGE}
\posttitle{\end{center}\noindent\rule{\linewidth}{2pt}}
\title{this is the title}

\begin{document}
\maketitle
...
\end{document}
Here you can find documentation for titling.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ajnabi
Posts: 10
Joined: Mon Jan 29, 2007 1:09 am

I can't get titling package to work

Post by ajnabi »

Thanks gmedina,

That cleared up a good bit about how to use the package. I read the documention but I'm still learning a good bit about LaTeX and couldn't quite figure out what to do.

I changed the example you gave, to printing three text lines, and I have one minor problem.

The following code works:

Code: Select all

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{titling}

\pretitle{\begin{center}\LARGE This is the pretitle \end{center}\begin{center}}

\posttitle{\end{center}\begin{center}\LARGE This is the post title\end{center}}

\title{\huge This is the title}

\begin{document}
\maketitle
...
\end{document}
except when I change:
\title{\huge This is the title}
to
\title{\HUGE This is the title}

I get the following error:

Code: Select all

! Undefined control sequence.
<argument> \HUGE
                 This is the title
l.16 \title{\HUGE This is the title}
Any idea why HUGE is not accepted?

Thanks for the help.
Frank
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

I can't get titling package to work

Post by gmedina »

Well, try \Huge (as far as I know LaTeX can't recognize \HUGE). The type size commands supported by LaTeX are:
  • \tiny
    \scriptsize
    \footnotesize
    \small
    \normalsize (default)
    \large
    \Large
    \LARGE
    \huge
    \Huge
By the way, I do not use LyX but this line seems a little odd to me: \documentclass[english]{article}; why do you declare english as a global option?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ajnabi
Posts: 10
Joined: Mon Jan 29, 2007 1:09 am

I can't get titling package to work

Post by ajnabi »

Thanks again! Call me dyslexic.
this line seems a little odd to me: \documentclass[english]{article}; why do you declare english as a global option?


It is automatically generated by LyX. I think it has to do with the package babel. To make the post cleaner I removed the line:
\usepackage{babel}
which is also generated by LyX. I didn't notice the "english" declaration.

Appreciate the help.

Frank
Post Reply