Text FormattingCustom Section/Paragraph/Text Styles

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

Custom Section/Paragraph/Text Styles

Post by jgrauman »

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:

http://grauman.com/sample.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.

Code: Select all

\section{Section Title}

\begin{sectiontext}
Section paragraph text.
\end{sectiontext}

\subsection{Subsection Title}

\begin{subsectiontext}
Subsection paragraph text.
\end{subsectiontext}

\subsection{Subsubsection Title}

\begin{subsubsectiontext}
Subsubsection paragraph text.
\end{subsubsectiontext}

\begin{paragraphtext}
Subsubsection paragraph text.
\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.

Code: Select all

\font\1="Gentium" at 16pt
\font\2="HK Grotesk" at 14pt
\font\3="HK Grotesk Light" at 12pt
\font\4="Gentium" at 10pt

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\1\itshape}}% 
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\2\bfseries}}%
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\3\bfseries}}%
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                     {3.25ex \@plus 1ex \@minus .2ex}%
                                     {-1em}%
                                     {\4\uline}}
\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!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Custom Section/Paragraph/Text Styles

Post by Johannes_B »

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.
jgrauman
Posts: 3
Joined: Tue Mar 12, 2019 7:22 pm

Custom Section/Paragraph/Text Styles

Post by jgrauman »

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

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

Custom Section/Paragraph/Text Styles

Post by jgrauman »

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...
Post Reply