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.

We have written a style class file and I need the abstract to be in a special format to the rest of the report. It ought to look like such:

Abstract - text text text...

But with the current configuration it looks like such:

Abstract - 

text text text...

The code we use that configures the abstract looks like such:

\renewenvironment{abstract}{
 \fontsize{10}{12}\selectfont
 \begin{changemargin}{10mm}{10mm}
 \noindent\em Abstract -
}{
 \end{changemargin}
}

I found out about the [runin] command but with my limited LaTeX knowledge don't know where to place it (I tried several positions but from the errors I get I doubt it's designed to work with the \renewenvironment{abstract} command).

Any help is appreciated!

Edit

Here is the change margin function

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
share|improve this question
    
Welcome to TeX.SE! –  Mico Mar 8 '13 at 11:08
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Peter Jansson Mar 8 '13 at 11:10
    
Force of habit... –  Max Z. Mar 8 '13 at 11:27
    
You need to show us your definition of changemargin. The one on the TeX FAQ does not produce a newline with your code. –  Andrew Swann Mar 8 '13 at 11:28
    
I just tried your environment but did not get a line break. With a minimal working example (MWE), in other words compilable code starting with \documentclass{...} and ending with \end{document}, it might be easier to reproduce your situation and find out what the issue is. (Sure which document class to use here needs some thought.) –  e-birk Mar 8 '13 at 12:01
show 1 more comment

1 Answer 1

up vote 1 down vote accepted

As noted in the comments your code does not produce a new line so there must be a blank line in the document.

The standard latex mechanism for producing displayed environments is to use list or \trivlist If you do this then it handles ignoring blank lines at the start and merging any space before or after the environment.

enter image description here

\documentclass{article}

%definition of quote with addition of [\textbf{Abstract --- ]
\renewenvironment{abstract}
               {\list{}{\rightmargin\leftmargin}%
                \item[\textbf{Abstract ---}]\relax}
               {\endlist}

\begin{document}

\begin{abstract}Red yellow blue\end{abstract}


\begin{abstract}

Red yellow blue

\end{abstract}

\end{document}
share|improve this answer
    
This helped a lot thanks! When using the code you provided, the Abstract --- was not aligned with the paragraph's margin. I fixed it by adding a \hspace{10mm} before the Abstract ---. –  Max Z. Mar 11 '13 at 15:09
add comment

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.