LaTeX forum ⇒ Text FormattingCustom Section/Paragraph/Text Styles

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Posts: 3
Joined: Tue Mar 12, 2019 7:22 pm

Custom Section/Paragraph/Text Styles

Postby jgrauman » Tue Mar 12, 2019 7:50 pm

Hello all,

Background: I used LaTeX around 18 years ago to write my Master's Thesis, and not since then except one project a long time ago. I wasn't sure whether my question should be posted here, or in XeTeX since I need to use .otf fonts, but the question is mainly about formatting...

I would like to figure out how to significantly alter all the Section, Subsection, Subsubsection and Paragraph titles, as well as the actual paragraph text which is under each title. I want it to look like the following pdf:

So the short question is: how can I use xelatex to generate something very similar to that pdf?

I imagine the .tex would look something like the following, but then I would redefine \section, \subsection, \subsubsection, \paragraph and add new attributes for sectiontext, subsectiontext, subsubsectiontext, paragraphtext. For each of these 8 parts of the document, I would like to be able to change: font, font size, bold, italic, underline, margins left, right, before, and after, and indent.

  1. \section{Section Title}
  3. \begin{sectiontext}
  4. Section paragraph text.
  5. \end{sectiontext}
  7. \subsection{Subsection Title}
  9. \begin{subsectiontext}
  10. Subsection paragraph text.
  11. \end{subsectiontext}
  13. \subsection{Subsubsection Title}
  15. \begin{subsubsectiontext}
  16. Subsubsection paragraph text.
  17. \end{subsubsectiontext}
  19. \begin{paragraphtext}
  20. Subsubsection paragraph text.
  21. \end{paragraphtext}

I tried redefining section, et al using \renewcommand and changing the font, italics, bold, etc. in the new commands. But I couldn't even get it to change the font or italics, much less all the spacing around the titles, etc.

  1. \font\1="Gentium" at 16pt
  2. \font\2="HK Grotesk" at 14pt
  3. \font\3="HK Grotesk Light" at 12pt
  4. \font\4="Gentium" at 10pt
  6. \makeatletter
  7. \renewcommand\section{\@startsection {section}{1}{\z@}%
  8. {-3.5ex \@plus -1ex \@minus -.2ex}%
  9. {2.3ex \@plus.2ex}%
  10. {\1\itshape}}%
  11. \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
  12. {-3.25ex\@plus -1ex \@minus -.2ex}%
  13. {1.5ex \@plus .2ex}%
  14. {\2\bfseries}}%
  15. \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
  16. {-3.25ex\@plus -1ex \@minus -.2ex}%
  17. {1.5ex \@plus .2ex}%
  18. {\3\bfseries}}%
  19. \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
  20. {3.25ex \@plus 1ex \@minus .2ex}%
  21. {-1em}%
  22. {\4\uline}}
  23. \makeatother

Sorry for the long question. I have been working piece by piece trying to figure everything out, but I've been at it for a couple days and feel like I haven't gotten anywhere, so I thought if someone can point me in the right direction, maybe I'm going about it all wrong. Thanks!

User avatar
Site Moderator
Posts: 4008
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Mar 12, 2019 9:39 pm

What documentclass are you using? Usually, there are no environments for the text in LaTeX (but it is common with ConTeXt).
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Posts: 3
Joined: Tue Mar 12, 2019 7:22 pm

Postby jgrauman » Tue Mar 12, 2019 11:34 pm

I was using \documentclass[12pt,letterpaper]{article}


Posts: 3
Joined: Tue Mar 12, 2019 7:22 pm

Postby jgrauman » Tue Mar 12, 2019 11:36 pm

Oh, and yes, I know it isn't common to put the regular text in an environment, but I need to have the text under each title formatted differently, so I was assuming that would be how to do that...

Return to “Text Formatting”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests