I'm having some problems on creating a class that changes the word "Definition" in \begin{definition}
according to a chosen language. For simplicity I will consider only the English language
The class file myreport.cls
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myreport}
\RequirePackage{changelang}
\DeclareOption{eng}{
\PassOptionsToPackage{\CurrentOption}{changelang}
}
\ProcessOptions\relax
\LoadClass[12pt, a4paper, twoside, notitlepage]{extreport}
\endinput
The file changelang.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{changelang}
\RequirePackage{amsmath, amssymb, amsthm}
\RequirePackage[T1]{fontenc} % output
%% language options
\DeclareOption{eng}{
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\providecommand*{\definitionautorefname}{Definition}
}
\ProcessOptions\relax
\endinput
Now when I try to use \begin{definition}
in the main document after choosing \documentclass[eng]{myreport}
, I get the complaint that it's undefined. Any ideas on how to correct that?
Thanks in advance.
\newtheorem{defi}
, therefore you should use\begin{defi}
and not\begin{definition}
. Also the MWE doesn't work because you load theextreport
class after thechangelang
package, therefore when you load the package thesection
counter is not defined yet, resulting in an error.begin{definition}
still undefined. Any ideas?halt-on-error
to make sure LaTeX stops at the very first error that is encountered. I tested your MWE and by loading theextreport
class directly after\ProvidesClass{myreport}
and fixing the typo for definition it worked without a problem.\...name
convention so declare your environment using\definitionname
rather thanDefinition
then define\definitionname
to beDefinition
with language options giving suitable translations. see\chaptername
,\contentsname
,\figurename
etc\xxxname
macros so that language customisation would not need to re-do complicated layout definitions, and simply supply localised versions of the strings