Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to have my "Problem Description" to have the same look/layout as abstract. Any way I can "clone" the the abstract command?

preamble:

\documentclass[pdftex,10pt,b5paper,twoside]{report}
\usepackage[lmargin=25mm,rmargin=25mm,tmargin=27mm,bmargin=30mm]{geometry}
share|improve this question
1  
don't use explicitly the pdftex option; the packages needing it are usually able to provide it implicitly. –  egreg Jun 14 '11 at 12:48
    
@egreg Ok, uni. template.. –  latexmp Jun 14 '11 at 12:56

2 Answers 2

up vote 6 down vote accepted
\newenvironment{problemdesc}
  {\renewcommand{\abstractname}{Problem Description}%
   \begin{abstract}}
  {\end{abstract}}

In this way you can also use the normal abstract environment.

If many kinds of this generalized abstract environment are needed, one can do the following

\newenvironment{genabstract}[1][]
  {\ifx\relax\detokenize{#1}\relax
     % no optional argument
   \else
     % provide the desired title
     \renewcommand{\abstractname}{#1}%
   \fi
   \begin{abstract}}
  {\end{abstract}}

The calls can then be

\begin{genabstract}
<regular abstract>
\end{genabstract}

\begin{genabstract}[Problem Description]
<problem description>
\end{genabstract}

Don't feed \abstractname as the optional argument, as this would cause infinite recursion (it would be possible to avoid this, but it seems overkill).

share|improve this answer
    
Even better would be to put \renewvommand{\abstractname}{Abstract} in the endcode I think? Or is there reason this would not work? –  romeovs Jun 14 '11 at 13:21
1  
@romeovs: every environment forms a group, so that \renewcommand would have no effect, because the "end part" is evaluated before the group ends. –  egreg Jun 14 '11 at 13:27
    
hmm, okay don't know about groups. Just seemed logical to change it back. You mean that it will only be changed inside the group then? –  romeovs Jun 14 '11 at 14:01
2  
@romeovs: the redefinition of \abstractname in the "begin part" will be undone anyway when the environment ends, because it's made inside a group. –  egreg Jun 14 '11 at 14:04
    
okay, all I needed to know! –  romeovs Jun 14 '11 at 15:09
\documentclass[english]{report}
\usepackage{babel,blindtext}
\begin{document}

{\renewcommand\abstractname{Problem Description}%
\begin{abstract}
\blindtext
\end{abstract}%
}

\begin{abstract}
\blindtext
\end{abstract}%

\blindtext
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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