Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style is incompatible with the cleveref and ntheorem packages. #7

Open
andrei-rizoiu opened this issue Nov 7, 2022 · 4 comments
Open

Comments

@andrei-rizoiu
Copy link

The current style cannot be used together with the cleveref and ntheorem packages, as they require the definition of theorems, lemmas and corollaries to happen after cleveref and ntheorem package calls. As the jmlr2e package needs to be called first, there is no way to load cleveref and ntheorem.

As a workaround, I edited the style file and I moved everything after line 361 (see content below) in the main tex file, after the loading of the other packages:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                              PROOF, THEOREM, and FRIENDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\BlackBox}{\rule{1.5ex}{1.5ex}}  % end of proof
\ifdefined\proof
    \renewenvironment{proof}{\par\noindent{\bf Proof\ }}{\hfill\BlackBox\\[2mm]}
\else
    \newenvironment{proof}{\par\noindent{\bf Proof\ }}{\hfill\BlackBox\\[2mm]}
\fi
\newtheorem{example}{Example} 
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{proposition}[theorem]{Proposition} 
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{axiom}[theorem]{Axiom}
@fabianp
Copy link
Member

fabianp commented Jan 4, 2023

hi @andrei-rizoiu . Does this solution have any other side effects? if not, could you please submit a pull request?

Thanks!

@andrei-rizoiu
Copy link
Author

Hi @fabianp -- I found another solution that does not require editing the style file: undefining the theorems and redefining them after the packages were loaded. Not sure where this should go in the style or the example tex.

Here is the example usage:

% load jmlr2e package
\documentclass[twoside,11pt]{article}
\usepackage{jmlr2e} 

% load required packages
\usepackage{ntheorem} 
\usepackage[nameinlink,capitalize]{cleveref}

% undefine theorems
\makeatletter
\def\cleartheorem#1{\expandafter\let\csname#1\endcsname\relax
    \expandafter\let\csname c@#1\endcsname\relax
}
\makeatother
\cleartheorem{example}
\cleartheorem{theorem}
\cleartheorem{lemma}
\cleartheorem{proposition}
\cleartheorem{definition}
\cleartheorem{corollary}

% redefine theorems
\newtheorem{example}{Example} 
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{proposition}[theorem]{Proposition} 
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}

@fabianp
Copy link
Member

fabianp commented Jan 23, 2023

that's great! Please add it to the example .tex file and make a pull request. Thanks!

@andrei-rizoiu
Copy link
Author

Done, see the open pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants