Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS class equivalent for LaTeX

Tags:

css

latex

I am trying to figure out if there is a way to apply the CSS methodology to the LaTeX template I am building. What I would like to do is to have a set of classes that apply a specific style treatment to the bracketed words. For example:

If I have three paragraphs of text, I want to have all of the paragraphs have [0.5cm] of spacing after the last line without having to add \\[0.5cm] after each paragraph.

Is there a LaTeX equivalent of defining the treatment for all paragraphs in the preamble so that it cascades throughout my document? The equivalent of:

<style> p {padding-bottom:0.5cm} </style>

I want to be able to specify multiple version of these CSS-like LaTeX classes throughout my document, so I don't need a specific solution. I need help understanding how to add custom labels/names/classes to the preamble and an example of how to use them in the document itself.

Thanks!

Ryan

like image 431
Ryan Scott Bardsley Avatar asked Feb 14 '11 19:02

Ryan Scott Bardsley


1 Answers

It sounds like you want to define your own environment. Below is an example from LaTeX wikibook.

Put this in your preamble:

\newenvironment{king}
{\rule{1ex}{1ex}\hspace{\stretch{1}}}
{\hspace{\stretch{1}}\rule{1ex}{1ex}}

And then use the style in the document:

\begin{king}
My humble subjects \ldots
\end{king}
like image 83
Matti Pastell Avatar answered Oct 11 '22 12:10

Matti Pastell