1

I'm trying to put together flash cards with algorithms on it. I get the following error:

! LaTeX Error: Not in outer par mode.

I've got two question:

  • What is the reason for this error?
  • How can I fix it?

I've got the error using the following code:

\documentclass[grid,avery5371]{flashcards}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[ruled,vlined,rightnl,linesnumbered]{algorithm2e}

\geometry{headheight=12pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}

\cardbackstyle[\LARGE\bfseries]{plain}
\cardfrontstyle[\large]{headings}


\begin{document}

\begin{flashcard}[graph]{\textsc{dfs}}
  \begin{algorithm}
    \caption{DFS(G)}
    \For{u $\in$ G.V}{
      u.color $\gets$ \textsc{white} \\
      u.$\pi$ $\gets$ \textsc{nil} \\
    }
    \For{u $\in$ G.V}{
      \If{u.color = \textsc{white}}{
        \textsc{dfs-visit}(G, u)
      }
    }
  \end{algorithm}
\end{flashcard}

\end{document}
  • Aha. Algorithm2e produces a float, unless you use [H]. Unfortunately, I'm having problems with flashcard even without the algorithm code. – John Kormylo Jul 2 '17 at 4:05
  • I had to manually load the avery5371.cfg file (not provided with MikTeX). – John Kormylo Jul 2 '17 at 15:57
1

At first I thought the text was too big, but \cardheight corresponds to two grid cells.

\documentclass[grid,avery5371]{flashcards}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[ruled,vlined,rightnl,linesnumbered]{algorithm2e}

\geometry{headheight=12pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}

\cardbackstyle[\LARGE\bfseries]{plain}
\cardfrontstyle[\large]{headings}

\usepackage{graphicx}

\begin{document}

\begin{flashcard}[graph]{\textsc{dfs}}
  \scalebox{.8}{\begin{algorithm}[H]
    \caption{DFS(G)}
    \For{u $\in$ G.V}{
      u.color $\gets$ \textsc{white} \\
      u.$\pi$ $\gets$ \textsc{nil} \\
    }
    \For{u $\in$ G.V}{
      \If{u.color = \textsc{white}}{
        \textsc{dfs-visit}(G, u)
      }
    }
  \end{algorithm}}
\end{flashcard}

\end{document}

demo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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