OK, it’s been a while since I’ve posted anything. But now it’s time to discuss a few ideas I have about chemmacros. As you are probably aware if you are a user of the package: it provides lots of different stuff. At least in my experience it is rarely the case that you need all of its features. So the idea is to make chemmacros a modular packages. By default let it activate only the basic features, the particle macros, say, and all other features are then loadable per use case. My idea is to have a similar mechanism like TikZ/pgf: [cce lang=”latex”]\loadchemlibrary{acid,iupac,phases}[/cce] chemmacros then would be split in the libraries particles, iupac, units, acid, charges, redox, mechanisms, thermodynamics, spectroscopy, reactions, phases, newman and orbitals, say. My questions to you:
  • What do you think in general of this idea?
  • What do you think about the library list? Is this a sensible list or should features be bundled in a library, particles and phases, say?
  • Which library or libraries should be loaded as default? What should be the basic functionality of chemmacros?
On other new concerning the active development of chemmacros please see the post chemmacros development. I am very interested in you opinion oder there, too!

12 thoughts on “modular chemmacros

  1. Johannes_B says:

    Initially i thought, “wow, great idea, get rid of that arrow stuff and decrease compile time.” But arrows are one of the most important things in a chemical formula. On my (quite old and powerless) machine, the following MWE takes 2 seconds to compile, much of it due to pgf.

    [cce lang=”latex”]\documentclass{article}

    It would certainly have the advantage, that a user is aware that he does something, i.e. explicitely reuire a library to work with it.

    If the library `units` would not be loaded, would the package still load `siunitx`?
    Can you see any improvements possible improvements in performance (compile time)?

    Would a splitting into libraries include the other packages of the bundle, basically making the functionality available as a chemlibrary (in addition to the package right now, or make the package just load the chemlibrary)?
    If so, what happens to the documentation?

    What should be the basic functionality? Not sure, i am not a chemist. But i think very basic `chemformula` functionality should be the default, everything else by request.

    Thanks for developing the package even further.

    1. cgnieder says:

      Although chemformula originally started as part of chemmacros I nowadays consider it a standalone package which is used by chemmacros like it uses siunitx.

      I believe that if a library (let’s call them that for now) needs a package then the library should load it. So if a library is not used the corresponding package may not be loaded any more. So: no units library no siunitx.

      chemformula, chemgreek and ghsystem will stay independent packages maintained and updated on their own. The development is completely independent from chemmacros nowadays.

      As for compilation time: you example needs 1.027s on my laptop. If I exchange chemformula with chemmacros it increases to 1.977s. So: other things besides pgf slow compilation time down. This means splitting chemmacros into libraries may indeed have impact on compilation time. It may also help me find out where this happens and if I can do anything about it.

      1. Johannes_B says:

        I guess for a real document the mere loading of packages has a marginally effect on loading time. But still i think the splitting in libraries might be a good idea.

        Right now, many users load packages without caring what it does, because of templates.If a template loads [cce inline=”true” lang=”latex”]chemmacros[/cce], but not any libraries, This could reduce implicit package incompatibilities. Altough, if a future template loads all libraries, the effect is gone.

        I’d really like to hear more input from people with more expertise.

        1. cgnieder says:

          I guess for a real document the mere loading of packages has a marginally effect on loading time.

          Probably true. The chemmacros manual is very much slowed down be the use of the [cce inline=”true” lang=”latex”]reaction[/cce] and [cce inline=”true” lang=”latex”]reactions[/cce] environments (both of which I am not very happy with to be honest but I can’t happily drop them any more…).

  2. cgnieder says:

    The more I think about it the more I like the idea. Still: before I go ahead it would be nice to hear thoughts of other users, too! 🙂

  3. canageek says:

    1) What is the advantage? Compile time seems to be to be pretty negligible.

    2) This is going to lead to more people having trouble with it. They accidentally don’t load something, things don’t work, then they have to get help.

    I already have trouble searching through the various manuals when I need to figure out which manual what I need is in.

    1. cgnieder says:

      To be honest: compile time is one of the reasons for me. The chemmacros manual takes several minutes to compile – noticable longer than other documents of a similar length. (I’ll give data in a while…) Personally I try to avoid using chemmacros as much as I can because of this.

      The other reason is maintainability. But this is a minor reason, really…

    2. cgnieder says:

      This is going to lead to more people having trouble with it. They accidentally don’t load something, things don’t work, then they have to get help.

      I’m not so sure about this… sure, there probably would be some confusion at first as always when there are changes in software but I don’t think that it would be a major problem. When the [cce inline=”true” lang=”latex”]chemnum[/cce] package completely changed it’s macro names and quite a bit of the syntax in the step from v0 to v1 I got no complaints and only very little questions on how to solve something with the new version.

      Not knowing which manual to look in is not knowing which package is providing a certain feature one uses but as far as this change of [cce inline=”true” lang=”latex”]chemmacros[/cce] is concerned this is not really an issue: all features currently described in the [cce inline=”true” lang=”latex”]chemmacros[/cce] manual would still be in the [cce inline=”true” lang=”latex”]chemmacros[/cce] manual. I am certainly not planning to write a manual for each library. More like: one section in the manul per library…

    3. cgnieder says:

      What if I made [cce inline=”true” lang=”latex”]chemmacros[/cce] modular but all libraries would be loaded per default? Then your concern 2) wouldn’t really be a problem would it. BTW: which features of [cce inline=”true” lang=”latex”]chemmacros[/cce] do you use regularly? Which do you rarely use?

      About 1) I have another possible advantage: in principle this would allow users to write libraries themselves and to extend [cce inline=”true” lang=”latex”]chemmacros[/cce] on their own.

  4. cgnieder says:

    Another idea: I could freeze [cce inline=”true” lang=”latex”]chemmacros[/cce] in its current state and publish the modular version under a different name, [cce inline=”true” lang=”latex”]chemistry[/cce], say… that way we can have both worlds but to be honest I am not much convinced of this idea, yet…

  5. Mike says:

    The idea is great (given that there is a good documentary :-).
    Basic functionality should be: writing reactions (with reaction environment and counting itself), using names and formulas in normal text. Perhaps drawing formulas (lewis etc.).

    Most of the other functions are totally great but it should be activated if needed. I would prefer to have a long list for setup instead of things I do not need for my current document.

    Relating for future plans:
    I would put the all new modularised chemmacros in a new package with a new name: chemmacrosmod (for modularised) or chemmod or chemistrymod or something like that. The old (not modularised) chemmacros gets bugfixes if needed (if you’ve been informed). Otherwise there will be no changes.
    This is status for, lets say, for 1 or 2 years. This needs to be communicated, clearly. After this period, all users have enough time to make the change to the future and you can bring chemmacros to an end.
    The old package should be removed everywhere, if possible. CATN, GitHub etc. Otherwise there will be huge chaos or knot garden. If it is removed, no (new) one can use it and is forced to use the new modularised package.

    These words are just my opinion.

    1. Clemens says:

      Thank you very much for your input! Very much appreciated! 🙂

      In my experience using the [cci_latex]reaction[/cci_latex] environment is not one of the most common tasks. Most people seem to use [cci_latex]equation[/cci_latex] environments and use [cci_latex]chemformula[/cci_latex]’s [cci_latex]\ch[/cci_latex] inside to have math and chemistry equations numbered the same. I have decided to preload these modules:

      • [cci_latex]base[/cci_latex] (programming concepts irrelevant for the user),
      • [cci_latex]lang[/cci_latex] (language support),
      • [cci_latex]greek[/cci_latex] (upright greek support),
      • [cci_latex]chemformula[/cci_latex] (chemformula integration),
      • [cci_latex]acid-base[/cci_latex] (writing [cci_latex]\pH[/cci_latex] and stuff),
      • [cci_latex]symbols[/cci_latex] (provide common symbols like [cci_latex]\standardstate[/cci_latex],
      • [cci_latex]charges[/cci_latex] (support various kinds of charges and charge symbols),
      • [cci_latex]particles[/cci_latex] (support for particle macros like [cci_latex]\prt[/cci_latex] and [cci_latex]\el[/cci_latex]),
      • [cci_latex]phases[/cci_latex] (support for phase descriptors), and
      • [cci_latex]nomenclature[/cci_latex] (the [cci_latex]\iupac[/cci_latex] macro and all the related stuff).

      Additional modules are going to be

      • [cci_latex]tikz[/cci_latex] (mainly programming support for tikz in expl3, irrelevant for the user),
      • [cci_latex]all[/cci_latex] (a pseudo module which simply loads all modules),
      • [cci_latex]isotopes[/cci_latex] (new functionality),
      • [cci_latex]mechanisms[/cci_latex] (the [cci_latex]\mech[/cci_latex] macro),
      • [cci_latex]newman[/cci_latex] (the [cci_latex]\newman[/cci_latex] macro),
      • [cci_latex]orbital[/cci_latex] (displaying orbital shapes),
      • [cci_latex]reactions[/cci_latex] (reaction environments),
      • [cci_latex]redox[/cci_latex] (oxidation numbers and redox reactions),
      • [cci_latex]scheme[/cci_latex] (a [cci_latex]scheme[/cci_latex] floating environment),
      • [cci_latex]spectroscopy[/cci_latex] (the [cci_latex]\NMR[/cci_latex] macro and the [cci_latex]experimental[/cci_latex] environment and related stuff),
      • [cci_latex]thermodynamics[/cci_latex] (the [cci_latex]\enthalpy[/cci_latex] macro and sibblings),
      • [cci_latex]units[/cci_latex] ([cci_latex]siunitx[/cci_latex] integration and a few “chemical” units), and
      • [cci_latex]xfrac[/cci_latex] (support for fractions, used by other modules and not very interesting for the user).

      I’ve also decided to still call it [cci_latex]chemmacros[/cci_latex] but add a [cci_latex]compatibility[/cci_latex] option. (I’ve done this in a way that I even can fix urgent problems in v4.7…)

Leave a Reply

Your email address will not be published. Required fields are marked *