Text Formattingmodifing the abstract position

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

modifing the abstract position

Post by NELLLY »

Hi
I need to have the following
Abstract: Texte
I used

Code: Select all

\renewcommand*\abstractname{Abstract\hfill}
I obtained:
Abstract
Texte
What should I add?
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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: modifing the abstract position

Post by localghost »

It is essential to know the used document class.


Best regards
Thorsten
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: modifing the abstract position

Post by NELLLY »

I use
\documentclass{article}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

modifing the abstract position

Post by localghost »

Changing the appearance of this environment is not simply done with redefining the abstract name. We have to borrow some code from the article class and rewrite the relevant part of the concerned code. The modifications are shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{lmodern}
\usepackage{blindtext}

\title{Modifcation of the \texttt{abstract} environment}
\author{NELLLY}

\makeatletter
\if@titlepage
  \renewenvironment{abstract}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}
\else
  \renewenvironment{abstract}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
        \small
        \list{}{%
          \settowidth{\labelwidth}{\textbf{\abstractname:}}
          \setlength{\leftmargin}{\labelwidth}
          \addtolength{\leftmargin}{\labelsep}
        }
        \item[\textbf{\abstractname:}]

      \fi}
      {\if@twocolumn\else\endlist\fi}
\fi
\makeatother

\begin{document}
  \maketitle
  \begin{abstract}
    \blindtext
  \end{abstract}
  \blinddocument
\end{document}
In case there is no title page and the document is typeset in one column, the abstract now is a list with the abstract name as a label. Other settings are untouched.
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

modifing the abstract position

Post by NELLLY »

Theanks Thorstan for the packages and the commands. However, there still one problem. In fact, the ligns in the abstract should be aligned with the word abstract.
This is what I should obtain:
Abstract:texte...................
texte...................................
texte...................................

What shoud I add?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

modifing the abstract position

Post by localghost »

NELLLY wrote:[...] In fact, the ligns in the abstract should be aligned with the word abstract.
This is what I should obtain:
Abstract:texte...................
texte...................................
texte...................................

What shoud I add?
This was not clear from your initial post.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{lmodern}
\usepackage{blindtext}

\title{Modifcation of the \texttt{abstract} environment}
\author{NELLLY}

\makeatletter
\if@titlepage
  \renewenvironment{abstract}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}
\else
  \renewenvironment{abstract}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
        \small
        \list{}{%
          \settowidth{\labelwidth}{\textbf{\abstractname:}}
          \setlength{\leftmargin}{0pt}
          \setlength{\itemindent}{\labelwidth}
          \addtolength{\itemindent}{\labelsep}
        }
        \item[\textbf{\abstractname:}]

      \fi}
      {\if@twocolumn\else\endlist\fi}
\fi
\makeatother

\begin{document}
  \maketitle
  \begin{abstract}
    \blindtext
  \end{abstract}
  \blinddocument
\end{document}
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Re: modifing the abstract position

Post by NELLLY »

This is perfect now.
thanks.
Post Reply