Appendix name repeated twice; How to get rid of the first instance?

I use for appendix the following function

\appendix
\renewcommand{\thesection}{\Roman{section}}

\section{appendix}

\section*{\text{Appendix I}}


But it gives me a double name of the section. How to 'erase' the first name for the appendix? (I wanted that it would be written 'Appendix I.').

-
Just remove \section{appendix}. –  Werner Jan 30 at 6:13
Why the \text command? –  egreg Jan 30 at 10:32

You're setting your numbering to capital roman numerals in your appendix, then you define two sections. The first one \section{appendix} will print I. appendix or appendix I. depending on your section definition. It will also appear in the ToC. The second one (last line) will not appear in the ToC, it will print Appendix I (though i don't know, what you're trying to achieve using \text{}), but it won't affect the counter you especially redefined, because of the * (unnumbered section. I think that is not a good practice for appendicies. Though I'm guessing which document class you're using, this MWE might be more of what you want

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{hyperref,url,ifthen,listings}
\begin{document}\noindent
\section{normal title}
\appendix
\renewcommand{\thesection}{Appendix \Roman{section}}
\section{An appendix title}
\section{Another}
This gets automatically the next number.
\end{document}


Every section after the redefinition gets Appendix and a roman numeral prepended. In the document and in the ToC.

-