0

I am working on a document that uses a custom class. I want to change the class so that it would use the babel[magyar] instead of the english version.

However, when I try to do so, I get the following error message:

E: .../Tester.tex:10 Undefined control sequence \begin{abstract}

My document uses a custom definition for the abstract environment, which works properly if babel is imported using:

\RequirePackage{babel}

Whenever I change this to:

\def\magyarOptions{defaults=safest}
\RequirePackage[magyar]{babel}

then compilation fails and I get the shown error message.

Can someone tell me how does this happens?

Update: I was asked to provide a minimum working example instead of the specification, here I used the article class, and replaced newenvironment with renewenvironment.

\documentclass{article}

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\def\magyarOptions{defaults=safest}
\RequirePackage[magyar]{babel}

\renewenvironment{abstract}{
    \checktoopen
    \tttypeout{\abstractname}
    \null\vfil
    \thispagestyle{plain}
    \begin{center}
    {\huge\textit{\abstractname} \par}
    \bigskip
    \end{center}
}

\begin{document}{}

\begin{abstract}

    The Thesis Abstract is written here (and usually kept to just this page). The page is kept centered vertically so can expand into the blank space above the title too\ldots
    %% TODO: megírni

\end{abstract}

\section{asda}

This is a test document.

\end{document}
6
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Commented Apr 29, 2016 at 15:28
  • 1
    But I have a custom document class :S I think I can post the same question with an article and "renewenvironment" is that okay? Commented Apr 29, 2016 at 15:33
  • 1
    Sorry, i get the same error message(s) when i remove the magyar. Also, they seem to be caused by \checktoopen and \tttypeout within the definition of abstract. Not the \begin{abstract} itself.
    – sheß
    Commented Apr 29, 2016 at 15:56
  • \checktoopen and tttypeout ... i know those commands. The custom class is based on book, which does not define an abstract environment. Hence, the class file defines it itself.
    – Johannes_B
    Commented Apr 29, 2016 at 17:58
  • Why use \RequirePackage instead of \usepackage? The former is meant only for package writers.
    – marczellm
    Commented Apr 29, 2016 at 19:07

2 Answers 2

1

It is better to ask template question by using the ask a question button, where you can be sure that someone familiar with the templates handles your question.

The language definition file for hungarian does not define a hungarian string for abstract. You gotta define one yourself.

\def\magyarOptions{defaults=safest}
\documentclass[magyar]{MastersDoctoralThesis}

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

\providecaptionname{magyar}{\abstractname}{abstractname magyar}
\renewenvironment{abstract}{
    \checktoopen
    \tttypeout{\abstractname}
    \null\vfil
    \thispagestyle{plain}
    \begin{center}
        {\huge\textit{\abstractname} \par}
        \bigskip
    \end{center}
}{\cleardoublepage}

\begin{document}{}

\begin{abstract}

    The Thesis Abstract is written here (and usually kept to just this page). The page is kept centered vertically so can expand into the blank space above the title too\ldots
                            %% TODO: megírni

\end{abstract}

\section{asda}

This is a test document.

\end{document}
2
  • Well, actually it does, but fails in this context because the template is stupid.
    – Johannes_B
    Commented Apr 29, 2016 at 18:25
  • A template cannot be stupid, but rather badly designed. It seems that one of the authors is guilty for that silly little bug. That happens when no real testing is done and not enough coffee is consumed.
    – Johannes_B
    Commented Apr 29, 2016 at 18:34
1

Apparently the issue has nothing to do with magyar.

  • Neither \checktoopen nor \tttypeout{} seem to be defined in any of the packages included or in the article class.

  • Environment (re)definitions take the form \renewenvironment{name}{before}{after}, where the after part specifies the code to be included whenever \end{name} is called. Your definition is missing that part.

I commented out those two commands and added a pair of empty braces at the end of the definition and it worked fine:

\renewenvironment{abstract}{
  %\checktoopen
  %\tttypeout{\abstractname}
  \null\vfil
  \thispagestyle{plain}
  \begin{center}
  {\huge\textit{\abstractname} \par}
  \bigskip
\end{center}
}{}

If you are basing your class definition in some other class out there, maybe you are missing some part of the code or a \RequirePackage{} command.

I hope it helps.

You must log in to answer this question.

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