0

I'm currently learning LaTeX and want to know how to make headings like in this document: http://www.math.northwestern.edu/~kra/papers/primes.pdf

Like 1. Introduction 2. etc etc

I'm thinking that it's got to involve \section somehow and centering it Thanks!

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 May 26 '14 at 8:37
  • \documentclass{amsart} \title{\bf HAPPY DAY} \author{L.~KP} \begin{document} \maketitle \centerline{1. INTRODUCTION} Hello, this is the closest I can get to the above document provided on my original post \end{document} – user52443 May 26 '14 at 8:38
  • Forgot to add: See if the amsart document class does everything you need. I.e. \documentclass{amsart}\begin{document}\section{Intro}etc.\end{document}. – Torbjørn T. May 26 '14 at 8:38
  • Thanks for your prompt reply, my TexStudio is lagging at the moment. I will get back to you when I try out that code you have provided me with! – user52443 May 26 '14 at 8:44
  • WOW!!!! Thank you so much Torbjørn T! :) I just tested out your code and it outputted something desirable. One more question: if I want to use LaTeX to compile a document for small proofs to help my friends (eg. why sqrt{2} is irrational), what is the most PROPER documentclass or page layout I should be using? Thanks – user52443 May 26 '14 at 8:51
1

Using titlesec as described on No newline after (sub)section? and especially http://www.latex-community.org/forum/viewtopic.php?f=5&t=10456 my proposal is:

\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}
       {\normalfont\bfseries\center}% formatting commands to apply to the whole section heading
       {\thesection .}% the label and number
       {0.5em}% space between label/number and section title
       {}% formatting commands applied just to section title
       []% punctuation or other commands following section title
\titleformat{\subsection}[runin]% runin puts it in the same paragraph
       {\normalfont\bfseries}% formatting commands to apply to the whole subsection heading
       {\thesubsection .}% the label and number
       {0.5em}% space between label/number and subsection title
       {}% formatting commands applied just to subsection title
       [.]% punctuation or other commands following subsection title
\begin{document}
        \section{This is a section}

        Some text following.

        \subsection{This is a subsection}

        Some more text following.
\end{document}

I hope that meets your requirements.

  • Thank you for your efforts but I already found what I need and is much simlper than your method of coding. Thanks again. – user52443 May 27 '14 at 11:17
  • No problem. Could you please publish your solution? – Typo May 27 '14 at 14:01
  • Sorry, how do I 'publish' my solution? Do I just comment on here? With help from Torbjon T. \documentclass{amsart}\begin{document}\section{Intro}etc.\end{document} – user52443 May 28 '14 at 7:32
  • I have no idea how to put larger pieces of code in a comment. Why not to create an answer and then to paste the code with the help editor of the answer function? – Typo May 29 '14 at 7:47
  • What are you on about..? – user52443 Jun 2 '14 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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