1

I want to redefine my abstract environment in the article class so that it starts with boldfaced Abstract followed by a dot and then the text. However, whenever I put the dot after \abstractname, it creates a large amount of horizontal space after it. Without the dot, it is fine. The problem persists even without boldfacing.

MWE for example where spacing is fine:

\documentclass{article}

\renewenvironment{abstract}{%
\small
\quotation
\abstractname
}
{\endquotation}

\author{Example Man}
\title{Minimal}
\begin{document}
\maketitle
\begin{abstract}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc justo libero, elementum id lobortis in, suscipit ultrices ex. Praesent efficitur suscipit metus at iaculis. Sed ac odio nec turpis eleifend accumsan ac ac ante. 
\end{abstract}
Phasellus viverra ipsum in leo rhoncus luctus. Mauris tempor nisl non leo iaculis sagittis. 
\end{document}

MWE for example where spacing is ruined:

\documentclass{article}

\renewenvironment{abstract}{%
\small
\quotation
\abstractname.
}
{\endquotation}

\author{Example Man}
\title{Minimal}
\begin{document}
\maketitle
\begin{abstract}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc justo libero, elementum id lobortis in, suscipit ultrices ex. Praesent efficitur suscipit metus at iaculis. Sed ac odio nec turpis eleifend accumsan ac ac ante. 
\end{abstract}
Phasellus viverra ipsum in leo rhoncus luctus. Mauris tempor nisl non leo iaculis sagittis. 
\end{document}

The desired end code would also have {\bfseries\abstractname.} or \textbf{\abstractname.}, but as I see, they are not the ones introducing the problem.

susypeti
  • 107

1 Answers1

3

You have to add a % sign to remove that space. Your first example will work without that because spaces after a control sequence are ignored. But in your second example, you end the environment definition with a period followed by space, so that space is inserted.

Please note that visually the space in the example looks a bit wider than it is due to the justification process extending that space. Just for comparison, I inserted a second example which is ragged right and shows that it is not larger than you want it to be.

As noted by moewe in the comments the space after the period is still wider than between words and in your setting (\nonfrenchspacing) this is the default, so it may contribute to the impression of too wide space.

abstracts

\documentclass{article}

\renewenvironment{abstract}{%
\small
\quotation
\abstractname.%
}
{\endquotation}
\newenvironment{abstractrr}{%
\small
\quotation
\raggedright
\abstractname.%
}
{\endquotation}

\author{Example Man}
\title{Minimal}
\begin{document}
\maketitle
\begin{abstract}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc justo libero, elementum id lobortis in, suscipit ultrices ex. Praesent efficitur suscipit metus at iaculis. Sed ac odio nec turpis eleifend accumsan ac ac ante. 
\end{abstract}
Phasellus viverra ipsum in leo rhoncus luctus. Mauris tempor nisl non leo iaculis sagittis. 
\begin{abstractrr}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc justo libero, elementum id lobortis in, suscipit ultrices ex. Praesent efficitur suscipit metus at iaculis. Sed ac odio nec turpis eleifend accumsan ac ac ante. 
\end{abstractrr}
\end{document}
TeXnician
  • 33,589
  • 1
    +1 You may want to mention that the space after a period is slightly larger than a normal interword space in the settings of the MWE (\nonfrenchspacing). This might have additionally contributed to the visual impression that there is too much space after the "abstract". – moewe Sep 08 '18 at 10:24
  • @moewe I edited the answer. – TeXnician Sep 08 '18 at 11:55
  • Thanks a lot @texnician and @moewe! I never knew why there were % symbols in TeX definitions after some commands without any comment. – susypeti Sep 09 '18 at 10:32
  • @susypeti A longer discussion can be found in https://tex.stackexchange.com/q/7453/35864 and linked questions. – moewe Sep 09 '18 at 10:34