[Tex/LaTex] New paragraph style for newbie

colorenvironmentsfontsmacrosparagraphs

This question may have already been asked, but with all of my searching, I couldn’t find it.

I am new to LaTeX and after a few rough starts, I am finding my way. I am using this tool to create consistency in the user manuals that I have to maintain. I am converting them from MS word, since that is what my predecessors used.

My question in this, in our manuals we often make reference to the company specifications. The typeface of them really has to stand out. I want to create a macro, command or environment to encapsulate the quotations from our specification books.

Currently, in our manuals, the specification is called out with the canned text of “Except from Awesome Company Specification Item 123.456 02 G/H. Creative Spec Name: “ This heading is bold, italicized, blue, and not indented. It is also set to use a different font from the rest of the document.

This is then followed by an expert of the specification text using a different 
font then the rest of the document.  Which is also different from the spec title.

Is this possible? My thoughts are to begin a new environment in the manual body. The {parameters} would be the spec Item number, and the Spec Name. This would then be followed by the body of specification text.

Best Answer

Here is a basic example that defines the companyquote environment:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{lmodern}% http://ctan.org/pkg/lm
\newenvironment{companyquote}[3][\parindent]
  {\bigskip\noindent\bfseries\itshape\sffamily\color{blue!80}% Colour and style of heading
   Except from Awesome Company Specification Item #2. #3:\par\nobreak%
   \color{black}\normalfont\itshape% Colour and style of excerpt
   \parshape 1 #1 \dimexpr\linewidth-#1-#1\relax% Indent & Width of excerpt
   \noindent\ignorespaces%
  }
  {\parshape 1 0pt \linewidth% Restore regular indent/width
   \bigskip}
\begin{document}
\lipsum[1]
\begin{companyquote}{123.456 02 G/H}{Creative Spec Name}
\lipsum[2]
\end{companyquote}
\lipsum[3]
\end{document}​​​​​

The companyquote environment takes three arguments, the first of which is optional.

  1. (Optional) indent on either side of the excerpt. Default is \parindent;
  2. The "spec item number"; and
  3. The "spec name".

I've added some gaps between the title and the other main text via \bigskip. More can be done, of course, with more information.

xcolor provides colour choices (blue!80 = 80% blue), while lipsum provides dummy text, Lorem Ipsum style. lmodern allows for font-requirements (bold, italicized font).

Related Question