3

I'm just starting LaTeX, but i want to learn how to write documents with it. I have to write a recommendation report and thought this would be as good of a time as any to learn. I started looking at the wiki tutorial here http://en.wikibooks.org/wiki/LaTeX, but I was wondering if there is something I could look at that's related to a recommendation report.

One thing I'm not sure how to do is create sections. I know there is \section{} and \subsection{}, but it's not what I am looking for. I am looking for formatting like \begin{abstract} where it will center it. And the subsections will be italicized and left justified.

Is there a way to do this, so when creating the table of contents, it will still create a full table of contents?

1

3 Answers 3

5

Generally, selecting a suitable document class is the "correct" solution. Unfortunately, most document styles either look the same (LaTeX default styles) or are very complicated (memoir and other highly customizable styles). To apply a hotfix to one of the standard LaTeX styles, use the titlesec package, specifically the \titleformat command:

\titleformat{\section}[block]{\centering\bfseries\normalsize}{\arabic{section}}{3pt}{}
\titleformat{\subsection}[hang]{\itshape}{\arabic{section}.\arabic{subsection}}{3pt}{}

What you're doing then is redefining the style of the \section and \subsection commands, i.e. how they're typeset. Their regular semantic meaning (among other things giving them an entry in the table of contents) will remain the same. The resulting section and subsection titles will look like this:

Document appearance after applying \titleformat commands

For further information on the titlesec package, see its manual on CTAN.

1
  • yea ive been experimenting with this. I got pretty close to what i need.
    – Matt
    May 6, 2011 at 21:28
3

Before you delve into code, it is normally best to select a document class, perhaps one that you are familiar with and then add packages and code to get to what you want. To help you here is a minimal that is based on the standard LaTeX article class. In the minimal below, I have included a couple of packages to show you how packages are added. The

\usepackage{makeidx}
\makeindex

is used to create an index. In your text whenever you need to index something you write \index{...}. To print it at the end you type \printindex.

\documentclass[11pt]{article} 
    \usepackage[utf8]{inputenc} 
    \usepackage{graphicx} 
    \usepackage{makeidx}
    \makeindex
    \usepackage{lipsum}
    \title{Recommendation report}
    \author{Dr Matt}
    \date{5th of May 2011} 
    \begin{document}
      \maketitle
      \tableofcontents   
      \listoffigures
      \listoftables
      \newpage
    \begin{abstract}
    \lipsum[3]
    \end{abstract}
    \section{First section}
    Your text\index{text} goes here.
    \subsection{A subsection}
    \lipsum[2]
     More text.
    \printindex
    \end{document}

Explore the minimal above (don't worry too much at first about the looks of the document). Once you are happy that you have a structure that reflects your requirements, you can then start thinking about presentational aspects of the document such as italic headings etc... For these there are a number of packages you can use, such as titlesec.

0

I recommend LyX [1]. It's great for beginners who want to learn-by-doing and don't want to learn commands or macro's. Once you get a hang of the system you can look at the LaTeX source and the output and learn how it works.

This way you can experiment while still being able to produce great documents.

[1] www.lyx.org

1
  • yea i saw that. been trying different IDEs.
    – Matt
    May 6, 2011 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .