3

I am trying to change the Caption name of Algorithmicx but it doesnt work. This what i include to use it.

%pseudocode
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\algtext*{EndWhile}% Remove "end while" text
\algtext*{EndIf}% Remove "end if" text
\algtext*{EndFor}
% \renewcommand{\ALG@name}{Pseudocode} doesnt work
\renewcommand{\listalgorithmname}{Liste der Pseudocodes}

I am getting this:

! LaTeX Error: Missing \begin{document}.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \renewcommand{\ALG@name}

And also \renewcommand{\algorithmcfname}{Pseudocode} doesnt work didnt work. Could someone tell me whats going wrong?


The requested MWE. Sorry if this meight be long but thats simply my header.

\RequirePackage[ngerman=ngerman-x-latest]{hyphsubst}
%etwas größere schrift als default
\documentclass[a4paper,12pt]{scrreprt}
\usepackage{geometry} 
%definiere ränder neu
\geometry{verbose,a4paper,tmargin=25mm,bmargin=20mm,lmargin=25mm,rmargin=25mm,includefoot}
%\geometry{a4paper, portrait, left=2.5cm, right=2cm, top=2cm, bottom=2cm, includefoot}
%change font
\usepackage{helvet}
%use urls right
\usepackage{hyperref}
%include der grafiken
\usepackage{graphicx}
\usepackage{float}
%bla deutsch
\usepackage[ngerman]{babel} 
%wrapping von figuren
\usepackage{wrapfig}

%mathequark
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amsfonts}


\usepackage[utf8]{inputenc} %for all äöü

\renewcommand{\contentsname}{Inhaltsverzeichnis} %% change name form content to inhals...
%\usepackage{cite}% citieren

\pagestyle{plain} % regular pagestyle

%command for codes inline
\providecommand{\code}[1]{\texttt{#1}}

%for the code
\usepackage{listings} %code
\usepackage{xcolor}
%change the caption
\renewcommand{\lstlistingname}{Code}
\renewcommand{\lstlistlistingname}{Codeverzeichnis} 
\usepackage{xcolor}

%grapfics
\usepackage{tikz,times}
\usetikzlibrary{mindmap,backgrounds}

%pseudocode
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\algtext*{EndWhile}% Remove "end while" text
\algtext*{EndIf}% Remove "end if" text
\algtext*{EndFor}
\renewcommand{\ALG@name}{}% doesnt work
\renewcommand{\listalgorithmname}{Liste der Pseudocodes}

\begin{document}
test
\end{document}
3
  • Could you provide a MWE which shows that error, please
    – user31729
    Commented Feb 24, 2014 at 16:15
  • actually those code above is enough to create the error. I using it with KOMA scrreprt. Also deleted the aux and toc to check if something went wrong.
    – BennX
    Commented Feb 24, 2014 at 16:18
  • Add the header which already produces the error without any code or text inside of the document.
    – BennX
    Commented Feb 24, 2014 at 16:21

1 Answer 1

5

You have tried to use the @ character in a command name, which is not directly possible, you have to 'mask' it with the commands \makeatletter before using the other command and afterwards change it back to \makeatother, see my code below.

\documentclass{report}

\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\algtext*{EndWhile}% Remove "end while" text
\algtext*{EndIf}% Remove "end if" text
\algtext*{EndFor}
\makeatletter  % Add this!!!!
 \renewcommand{\ALG@name}{Pseudocode} %doesnt work
\makeatother   % Add this also
\renewcommand{\listalgorithmname}{Liste der Pseudocodes}


\begin{document}

Some text to be written in here!

\end{document}

However, since I have no other information, what you intended, I can not say, whether this works at all -- there are no compilation errors, at least.

3
  • @BennX: Ok, that sounds good. I hope, it is really the solution you preferred!
    – user31729
    Commented Feb 24, 2014 at 17:12
  • Yes it is. Thanks for that. I just were wondering because people use that solution without the marks i need to add now. But anyways it works.
    – BennX
    Commented Feb 24, 2014 at 17:41
  • 1
    @BennX: Perhaps they used the \renewcommand{\ALG@name}{Pseudocode} line (or something similar in a package (sty) file; in this case neither \makeatletter nor \makeatother are needed then.
    – user31729
    Commented Feb 25, 2014 at 19:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .