15

Here is the list of packages I load for my presentation:

\documentclass{beamer}
\usepackage[frenchb]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{stmaryrd}
\usepackage{amsthm}
\usepackage{color}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage[boxed]{algorithm2e}
\usepackage{algorithmic}
\usepackage[parfill]{parskip}
\usepackage{stmaryrd}
\usepackage{caption}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bbm}
\usepackage{bm}
\usepackage{empheq}
\usepackage{framed}
\usepackage{mathbbol}
\usepackage{float}
\usepackage{caption,subcaption}%
\usepackage{calc}% http://ctan.org/pkg/calc
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{environ}
\usetikzlibrary{positioning,shapes,shadows,arrows,shapes.multipart}

There are 4 packages (as follows) that I use for my article, but if I add them to the list, it gives me an error Command \algorithmic already defined. I guess some packages are not compatible with the one above:

\usepackage{algpseudocode}
\usepackage[all]{xy}
\usepackage{longtable}
\usepackage{listings,xcolor,lipsum}

Without loading the 4 packages, one problem is that a formula like abc_\textbf{index} which works in my article does not work anymore, so I need to change it to abc_{\textbf{index}}. And I have a lot of formulae having that...

So could anyone tell me which package is relevant to that? and how to add it to the list for my presentation?

Thank you very much!

5
  • 1
    algpseudocode defines an algorithmic environment (and therefore not compatible). That's what algcompatible is for. See the algorithmicx package documentation. However, also as mentioned in the documentation, this is "used only in old documents."
    – Werner
    Commented Aug 29, 2011 at 22:29
  • Thanks for your reply... but the other 3 packages still can not be used, and the formula of abc_\textbf{index} is still not accepted.
    – SoftTimur
    Commented Aug 29, 2011 at 22:31
  • Are all the packages you load really necessary? multicol: beamer provides a columns environment; float, longtable: do you have any of these in your presentation? Regarding abc_\textbf{index} vs. abc_{\textbf{index}}: Using the article documentclass rather than beamer in a minimal example works for both, but on the latter works in beamer. Or does the loading of the mentioned 4 packages solve this problem in beamer?
    – Werner
    Commented Sep 1, 2011 at 7:14
  • @Werner: would you make an answer out of your comments?
    – egreg
    Commented Sep 2, 2011 at 9:13
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – jub0bs
    Commented Sep 15, 2014 at 6:48

1 Answer 1

11

algpseudocode (as part of the algorithmicx package) defines an algorithmic environment, and is therefore not compatible. That is, algorithmicx.sty defines the algorithmic environment using

\newenvironment{algorithmic}[1][0]%
  {...}

Specifying the package option

\usepackage[algcompatible]{algpseudocode}

only allows for compatibility with the former algorithmic package notation. That is, commands like \REQUIRE, \ENSURE, \STATE and \COMMENT are directed to imply \item[\algorithmicrequire], \item[\algorithmicensure], \State and \Comment under algorithmicx. Regardless, you are not able to use both algorithmic and algorithmicx in your document preamble.

The beamer document class does not enjoy abc_\textbf{index}, while the article document class doesn't complain. I'm guessing there might be something internally done by beamer that modifies the regular usage. If this is problematic, I'm sure you could use something like sed to parse your existing .tex document and replace all occurrences of <stuff>_<sub-stuff> with <stuff>_{<sub-stuff>}. Regardless, if this is a restriction in beamer, it may be useful to embrace it, both literally and figuratively.

You must log in to answer this question.

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