Giter VIP home page Giter VIP logo

create-theorem's People

Contributors

jinwen-xu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

create-theorem's Issues

Highlight the necessity of a backend

When one reads the first section “How to load it” of the create‐theorem's documentation, what appears immediately is:

\usepackage[ ⟨options⟩ ]{create-theorem}

and I guess that most of the beginners in your package just add this line to their preamble and only when the compilation fails, they have a deeper look and read the sentence: “First, you need a backend to provide the command \newtheorem with the usual behaviour, for example, amsthm or ntheorem.”

Hence, I suggest to highlight the necessity of a backend with a first listing being:

\usepackage{amsthm}
% or \usepackage{ntheorem}
...
% near the end of the preamble
\usepackage[ ⟨options⟩ ]{create-theorem}

QED symbol compatibility with amsthm

In recent tests I have found some issues with the qed setup of create-theorem. To configure an environment with QED symbol, I have to load amsthm to provide the commands \pushQED, \popQED and \qed. However, this would cause multiple QED symbols generated.

\documentclass{ctexart}
\usepackage{amsthm}
\usepackage{create-theorem}

\CreateTheorem{proof}{name={heading={证明}},qed=\rule{1ex}{1ex}}

\begin{document}

\begin{proof}[foo]
    some proof
\end{proof}

\begin{proof}
    some proof
\end{proof}

\end{document}

The MWE above would generate the result as follows. Note that this is actually the proof environment defined by amsthm with an additional QED symbol.

image

The problem could be resolved by defining those commands mentioned by the package itself. The next MWE generates the desired result, where the qed command is simply borrowed from amsthm. There is still one problem with this approach, which is that the default value of qed key is not valid.

\documentclass{ctexart}
\usepackage{create-theorem}

\makeatletter
\DeclareRobustCommand{\qed}{%
  \ifmmode \mathqed
  \else
    \leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
    \quad\hbox{\qedsymbol}%
  \fi
}
\ExplSyntaxOn
\seq_new:N \l_qed_stack_seq
\cs_set_protected:Npn \pushQED #1
    { \seq_push:Nn \l_qed_stack_seq {#1} }
\cs_set_protected:Npn \popQED
    { \seq_pop:NN \l_qed_stack_seq \l_tmp_tl \l_tmp_tl }
\ExplSyntaxOff
\makeatother

\CreateTheorem{proof}{name={heading={证明}},qed=\rule{1ex}{1ex}}

\begin{document}

\begin{proof}[foo]
    some proof
\end{proof}

\begin{proof}
    some proof
\end{proof}

\end{document}

image

It is also worth mentioning that not loading amsthm will also cause problems with numberless option, which I have not found a proper solution so far.

Check whether external commands involved are defined

Discussed in #3:

I am aware that the LaTeX2e kernel provides only the \newtheorem command, while \newtheorem* and \theoremstyle are implemented by amsthm or other similar packages. The absence of the very commands would generate weired error messages in the terminal. Maybe create-theorem should check the presence of those and prompt messages?

Two counter aliasing utilities

Currently two different counter aliasing macros are used

  • \newaliascnt from package aliascnt which globally lets \c@<cnt>, \the<cnt>, \theH<cnt> and \p@<cnt>, and globally defines \cl@<cnt> (to hold the \cl@<mirrored cnt>)
  • \crthm_counter_alias:nn, which locally lets \c@<cnt>, \cl@<cnt> and \the<cnt>.

Are these differences on purpose?

Standard set of theorems

Many thanks for this very nice, clean and useful package!

What would make easier the user's life, is to provide a standard set of theorems, just as does ntheorem (see section 2.3.6, page 8 of its documentation). In other words, to provide an actual configuration just sketched in the examples in section 3.5 of create‐theorem's documentation.

Configuring the theorem names per language instead of per environment

The command for naming the theorem-like environments currently works like this:

\NameTheorem { application }
  {
    , heading =   {
                    , english     = Application
                    , french      = Application
                    ...
                  }
    , crefname =  {
                    , english     = {application}{applications}
                    , french      = [l']{application}[les]{applications}
                    ...
                  }
    , Crefname =  {
                    , english     = {Application}{Applications}
                    , french      = [L']{application}[Les]{applications}
                    ...
                  }
  }

It was originally designed this way to make it easier when adding new environments - instead of adding the code here and there, one only needs to add a bunch of code in one place.

However, this approach is very inconvenient for maintaining language files. Instead, it would be nice to have a new command \NameTheorems with the following syntax:

\NameTheorems { english }
  {
    , heading =   {
                    , theorem        = ...
                    , proposition   = ...
                    ...
                  }
    , crefname =  {
                    , theorem        = ...
                    , proposition   = ...
                    ...
                  }
    , Crefname =  {
                    , theorem        = ...
                    , proposition   = ...
                    ...
                  }
  }

In this way, the names can be maintained per language.

Providing interface for setting up QED symbol

Hello! Thanks for your excellent work. I am considering switching from ntheorem to create-theorem, since with the former package the adjustment of any theorem-like environment can only be done by redefining it.

However, there is one major feature that I believe is absent from create-theorem, the QED symbol, which is particularly useful in proof environment and has already been implemented by many of the package's counterparts. Therefore, would you please add the above-mentioned feature?

A desired example may look like

\CreateTheorem{proof}{
    name = {
        heading = {证明}
    },
    numberless,
    qed-symbol = {\ensuremath{\QED}} # new interface
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.