8

I'm writing a document with and abstract and I've set the language to Spanish, and so the abstract environment displays the word "Resumen" instead of "Abstract". I want the opposite. I've tried

\renewcommand{\abstractname}{Abstract}

And

\renewcommand{\abstract}{Abstract}

The first does nothing and the second displays the word Abstract but removes the bold font, puts it in the beginning of the line and the abstract text displays just after it, something like:

Abstract. This is the abstract...

How should I properly change it? The class document is article

Thanks in advance

marked as duplicate by Sverre, Paul Gessler, user13907, T. Verron, Andrew Apr 24 '15 at 11:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Welcome to TeX.SX! This depends on the document class. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 24 '15 at 6:26
  • \renewcommand{\abstract}{Abstract} is of course wrong, since you have changed the \abstract command (or environment) completely – user31729 Apr 24 '15 at 6:29
  • Is the abstract in english or spanish? – Johannes_B Apr 24 '15 at 8:44
  • @Johannes_B Spanish, but the word Abstract is always used. This is for a project and I believe leaving the spanish word would be better just for consistency, but I have to use Abstract. – MyUserIsThis Apr 24 '15 at 9:30
  • @Sverre The OP says that \renewcommand\abstractname{...} doesn't work the expected way. How is it a duplicate then? – yo' Apr 24 '15 at 11:28
3

This is a guess of a working document, since there is no information on the document class so far.

Use the \selectlanguage{english} feature of babel for the abstract and change later on to spanish.

I assumed article as underlying class.

I've added some unneeded commands to show the language change.

\documentclass{article}

\usepackage[english,spanish]{babel}
\usepackage{blindtext}

\begin{document}
\selectlanguage{english}

\begin{abstract}
\blindtext
\end{abstract}
\tableofcontents


\selectlanguage{spanish}

\section{\contentsname}

\end{document}

enter image description here

Here is scrartcl version (with some 'improvements')

\documentclass[abstract]{scrartcl}

\usepackage[english,spanish]{babel}
\usepackage{blindtext}

\usepackage{xpatch}
\xpretocmd{\abstract}{\selectlanguage{english}}{}{}  % Switch automatically to english
\xapptocmd{\endabstract}{\selectlanguage{spanish}}{}{} % Switch back at end of {abstract}

\begin{document}

\begin{abstract}
\blindtext
\end{abstract}
\tableofcontents



\section{\contentsname}

\end{document}
  • 1
    The class was article. And that solved my problem. I didn't know of the existence of \selectlanguage. Thank you very much for your help. – MyUserIsThis Apr 24 '15 at 7:40
  • @MyUserIsThis: Alright. Thanks for accepting, but please, please, provide more information next time ;-) – user31729 Apr 24 '15 at 7:43
  • 1
    I'll do in the future. I always use the article class so I thought these solutions were more or less universal. Thank you again. – MyUserIsThis Apr 24 '15 at 7:47
  • I'd recommend setting the abstract environment inside an otherlanguage environment: \begin{otherlanguage}{english}\begin{abstract} ... \end{abstract}\end{otherlanguage} (freely add line breaks), rather than using \selectlanguage. – egreg Apr 24 '15 at 8:53
9

Change the name of the abstract after \begin{document}.

\documentclass[spanish]{article}
\usepackage{babel}
\begin{document}
\renewcommand{\abstractname}{myuseristhis}
\begin{abstract}este es un buen pato
\end{abstract}
\end{document}

Important thing is, not changing the language to english just to get the abstract name right, as hyphenation pattern for english and spanish are different.

3

Your first command has of course changed it but to the same title!

Check with this, you will see the difference

 \renewcommand{\abstractname}{Resumen}
  • This is a guess at the moment, as we do not have enough information – user31729 Apr 24 '15 at 6:32
  • I think i got the question wrong! Sorry ignore my answer – Ambika Vanchinathan Apr 24 '15 at 6:33
  • We've to wait. My answer is a guess only at the moment too – user31729 Apr 24 '15 at 6:39
  • @Christian Hupfer: I guess that you have exactly answered the question. – Ambika Vanchinathan Apr 24 '15 at 6:41
  • I want to do the oposite. It displays Resumen because I've set the document in spanish (because I need all the rest of the keywords translated), but I want the word abstract in english. – MyUserIsThis Apr 24 '15 at 7:38

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