Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
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 Aug 29 '11 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 Aug 29 '11 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 Sep 1 '11 at 7:14
    
@Werner: would you make an answer out of your comments? –  egreg Sep 2 '11 at 9:13

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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