22

Let's take article document class with bibliography:

\documentclass{article}
\begin{document}
Some text \cite{key01}.
\begin{thebibliography}{9}% 2nd arg is the width of the widest label.
\bibitem{key01}
Beeblebrox, Zaphod, Galactic University Press
etc. etc.`
\end{thebibliography}
\end{document}

Above list of bibliography entries there is References which looks like generates with: \section*{References} .

I would like it to look like default text.

How to change it ?

Should I \renewcommand to overwrite default \section ? If yes, how to revert default \section later ? If other more elegant option exists, could you provide ?

(pdflatex)

11

You can use the \let\store\macro command, which saves the current definition of \macro to \store.

The Code

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}

\begin{document}

\section{test}

\let\oldsection\section
\renewcommand*{\section}[1]{#1}

\section{new test}

\let\section\oldsection

\section{reverted?}

\end{document}

The Output ##

enter image description here


Edit 1: Much easier, fully working approach: use options inside \renewcommand{\refname}{}.

The Code

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}

\begin{document}

\section{test}

\renewcommand{\refname}{\normalfont\selectfont\normalsize References} 

\section{new test}

  \begin{thebibliography}{depth}
    \bibitem{atuning}Volker Wollny (Hrsg.): {\it Amiga--Tuning}.
                     Interest--Verlag, Augsburg, 1996.
  \end{thebibliography}

\section{reverted?}

\end{document}

The Output

enter image description here

  • 2
    I like more your first solution; using the second approach you are also silently modifying possible headers since \refname is used to produce them, and this could not be desirable. – Gonzalo Medina Aug 29 '12 at 3:50
  • @GonzaloMedina: But the first one doesn't work properly: it prints *References instead of References, due to the bibliography using section* I think. However trying the \let course as before fails for section*. – Tom Bombadil Aug 29 '12 at 3:58
  • You're right; first one doesn't work. – Gonzalo Medina Aug 29 '12 at 4:00
17

One option would be to use the titlesec package to locally redefine the section formatting:

\documentclass{article}
\usepackage{titlesec}

\begin{document}

\section{Test Section One}

\begingroup
\titleformat*{\section}{\normalfont}
\begin{thebibliography}{depth}
\bibitem{a} Test
\end{thebibliography}
\endgroup

\section{Test Section Two}

\end{document}

enter image description here

Another option is to patch the \thebibliography command to replace the default \section*{\refname} with \refname; this can be easily done with the help of the etoolbox package:

\documentclass{article}
\usepackage{etoolbox}

\patchcmd{\thebibliography}{\section*{\refname}}{\refname}{}{}

\begin{document}

\section{Test Section One}

\begin{thebibliography}{depth}
\bibitem{a} Test
\end{thebibliography}

\section{Test Section Two}

\end{document}

Without any packages, the necessary redefinition would be:

\documentclass{article}

\makeatletter
\renewenvironment{thebibliography}[1]
     {\refname%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

\begin{document}

\section{Test Section One}

\begin{thebibliography}{depth}
\bibitem{a} Test
\end{thebibliography}

\section{Test Section Two}

\end{document}

The last two examples produce the same output as the first one, so I didn't upload the repeated images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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