Algorithm2e tries to define a command \csname ö\endcsname in your example. The problem is that the "ö" is already a command and - as you are using OT1 font encoding - it contains commands which can't be used in \csname. You can use \usepackage[T1]{fontenc}
. This will solve the problem with the ö. But on the whole I do find it rather problematic how algorithm2e defines commands without checking. I would suggest the nokwfunc option.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage%[nokwfunc] % enable it to see the difference
{algorithm2e}
\usepackage[T1]{fontenc}
\begin{document}
\section{A}
\begin{procedure}
foo \caption{ö()}
\end{procedure}
\begin{procedure}
foo \caption{section()}
\end{procedure}
\section{B}
\end{document}
Using the 'aps' option for a revtex4-1 documentclass, the following solution allows to keep all other particularities of the aps bibliographic style unchanged. Notably, it is possible to use a modified version of apsrev4-1.bst but this will probably affect the other behaviours. Here we will simply overwrite the parameters passed to apsrev4-1.bst style file.
Originally, the output of the RevTex package without 'longbibliography' will be
Now when you add the 'longbibliography' option you get this
with the awful mix of initials and full first names.
Actually the parameters for building the bibliography are stored in an extension of the .bib file called [Your file]Notes.bib of your document folder. To overwrite its output, add into your preamble, after the calls to packages,
\AtBeginDocument{%
\newwrite\bibnotes
\def\bibnotesext{Notes.bib}
\immediate\openout\bibnotes=\jobname\bibnotesext
\immediate\write\bibnotes{@CONTROL{REVTEX41Control}}
\immediate\write\bibnotes{@CONTROL{%
apsrev41Control,author="08",editor="1",pages="1",title="0",year="1"}}
\if@filesw
\immediate\write\@auxout{\string\citation{apsrev41Control}}%
\fi
}%
This will replace the text generated at the time of building the file. You can set manually all parameters in these lines of code. Here author="08" stands for "initials for authors". The integer value used for authors is actually encoded in a sum of powers of two, each one corresponding to a different parameter. title="0" allows the production of the article titles. Your output now looks like this
Note that the use of 'longbibliography' option is now ineffective but replaced by the manual values.
Beyond just initials, here is the list of all authors parameters as found in apsrev4-1.bst
'control.author.jnrlst swap$ duplicate$ #64 control.decode
'control.author.dotless swap$ duplicate$ #32 control.decode
'control.author.nospace swap$ duplicate$ #16 control.decode
'control.author.initials swap$ duplicate$ #8 control.decode
'control.author.nocomma swap$ duplicate$ #4 control.decode
'control.author.first swap$ duplicate$ #2 control.decode
'control.author.reversed swap$ duplicate$ #1 control.decode
so for example use 16+8+1=25 to reverse order without spaces and use of initials. You need to set editor="0" to allow full control over author format. The parameter entered for author="HH" is actually an hexdecimal value. This means that for the previous example you have to set author="19"
Best Answer
There is an incompatibility between the
algorithm2e
/algorithmic
packages andrevtex4-1
; one possibility is to usealgcompatible
instead ofalgorithmic
(the syntax of the commands is the same and this solves the indentation problem) and to use thenewfloat
package to define a newalgorithm
float. Here's an example illustrating this approach (I used atable
and afigure
environments to show how the newly defined float behaves consistently with the class):If one wants to keep the
ruled
style of thealgorithm
environmet, as defined inalgorithm2e
, some additional work has to be done; in this case, thecaption
package could be used (providing one makes the necessary adjustments to recover the formatting defined inrevtex4-1
); here's such possibility with a little example:If, for some reason, the
newfloat
packageis not available, one can use thetrivfloat
instead: