summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex213
1 files changed, 213 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex
new file mode 100644
index 00000000000..5963e3e2260
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex
@@ -0,0 +1,213 @@
+% --------------------------------------------------------------------------
+%
+% the CHEMMACROS package -- module: `scheme'
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% --------------------------------------------------------------------------
+% https://github.org/cgnieder/chemmacros/
+% contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+% Copyright 2011-2015 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+\ChemModule{scheme}{2015/06/09 a scheme floating environment}
+
+\RequirePackage {chemnum}
+
+\bool_new:N \l__chemmacros_float_def_bool
+\tl_new:N \l__chemmacros_float_method_tl
+\seq_new:N \l__chemmacros_float_methods_seq
+\prop_new:N \l__chemmacros_float_methods_prop
+\prop_new:N \l__chemmacros_float_definitions_prop
+
+% --------------------------------------------------------------------------
+% #1: name
+% #2: check
+\cs_new_protected:Npn \chemmacros_define_float_method:nnn #1#2#3
+ {
+ \seq_put_right:Nn \l__chemmacros_float_methods_seq {#1}
+ \prop_put:Nnn \l__chemmacros_float_methods_prop {#1} {#2}
+ \prop_put:Nnn \l__chemmacros_float_definitions_prop {#1}
+ { \cs_set_protected:Npn \__chemmacros_define_float:n ##1 {#3} }
+ }
+
+% the order in which the methods are defined determines in which order the
+% methods will be checked at begin document:
+\chemmacros_define_float_method:nnn {KOMA}
+ { \cs_if_exist_p:N \KOMAClassName }
+ {
+ \DeclareNewTOC[
+ type = #1 ,
+ types = #1s ,
+ float ,
+ name = \chemmacros_translate:n {#1-name} ,
+ listname = {\exp_not:N \chemmacros_translate:n {#1-list}}
+ ]{los}
+ }
+
+\chemmacros_define_float_method:nnn {memoir}
+ { \chemmacros_if_class_loaded_p:n {memoir} }
+ {
+ \newfloat [chapter] {scheme} {los} {\chemmacros_translate:n {#1-name}}
+ \cs_set:Npn \thescheme {\thechapter.\@arabic\c@scheme}
+ \newlistof {listofschemes} {los} {\chemmacros_translate:n {#1-list}}
+ \newlistentry [chapter] {scheme} {los} {0}
+ \cftsetindents {scheme} {0em} {2.3em}
+ \tl_put_right:Nn \@memfront@floats
+ { \counterwithout {scheme} {chapter} }
+ \tl_put_right:Nn \@memmain@floats
+ { \counterwithin {scheme} {chapter} }
+ \tl_put_right:Nn \@memback@floats
+ {
+ \counterwithin {scheme} {chapter}
+ \setcounter {scheme} {0}
+ }
+ \chemmacros_tex_if:nT {artopt}
+ { \counterwithout {scheme} {chapter} }
+ }
+
+\chemmacros_define_float_method:nnn {tocbasic}
+ { \chemmacros_if_package_loaded_p:n {tocbasic} }
+ {
+ \DeclareNewTOC[
+ type = #1 ,
+ types = #1s ,
+ float ,
+ name = \chemmacros_translate:n {#1-name} ,
+ listname = {\exp_not:N \chemmacros_translate:n {#1-list}}
+ ]{los}
+ }
+
+\chemmacros_define_float_method:nnn {newfloat}
+ { \chemmacros_if_package_loaded_p:n {newfloat} }
+ {
+ \DeclareFloatingEnvironment[{
+ fileext = los ,
+ listname = {\exp_not:N \chemmacros_translate:n {#1-list}} ,
+ name = #2
+ }]{#1}
+ }
+
+\chemmacros_define_float_method:nnn {float}
+ { \chemmacros_if_package_loaded_p:n {float} }
+ {
+ \newfloat {scheme} {htp} {los}
+ \floatname {scheme} {\chemmacros_translate:n {#1-name}}
+ \cs_new_protected:Npn \listofschemes
+ { \listof {scheme} {\chemmacros_translate:n {#1-list}} }
+ }
+
+% --------------------------------------------------------------------------
+% checks if one of the above defined methods is active. The first one found
+% will be used.
+\cs_new_protected:Npn \chemmacros_check_float_method:n #1
+ {
+ \prop_get:NnNT \l__chemmacros_float_methods_prop {#1}
+ \l__chemmacros_tmpa_tl
+ \bool_if:nT
+ { !\l__chemmacros_float_def_bool && \l__chemmacros_tmpa_tl }
+ {
+ \bool_set_true:N \l__chemmacros_float_def_bool
+ \tl_set:Nn \l__chemmacros_float_method_tl {#1}
+ }
+ }
+
+\cs_new_protected:Npn \chemmacros_check_float_methods:
+ {
+ \seq_map_function:NN
+ \l__chemmacros_float_methods_seq
+ \chemmacros_check_float_method:n
+ }
+
+\AtBeginDocument
+ {
+ \chemmacros_check_float_methods:
+ \chemmacros_define_float:n {scheme}
+ }
+
+% --------------------------------------------------------------------------
+% #1: env name
+\cs_new_protected:Npn \chemmacros_define_float:n #1
+ {
+ \bool_if:nT
+ { !\cs_if_exist_p:c {#1} && !\cs_if_exist_p:c {#1} }
+ {
+ \bool_if:NTF \l__chemmacros_float_def_bool
+ {
+ \prop_get:NVN \l__chemmacros_float_definitions_prop
+ \l__chemmacros_float_method_tl
+ \l__chemmacros_tmpa_tl
+ \tl_use:N \l__chemmacros_tmpa_tl
+ \__chemmacros_define_float:n {#1}
+ }
+ {
+ \newcounter {scheme}
+ \cs_set:Npn \thescheme {\@arabic\c@scheme}
+ \cs_new:Npn \fps@scheme {tbp}
+ \cs_new:Npn \ftype@scheme {8}
+ \cs_new:Npn \ext@scheme {los}
+ \cs_new:Npn \fnum@scheme {\schemename\nobreakspace\thescheme}
+ \cs_new:Npn \schemename {\chemmacros_translate:n {#1-name}}
+ \cs_new:Npn \listschemename {\chemmacros_translate:n {#1-list}}
+ \newenvironment {scheme}
+ {\@float{scheme}}
+ {\end@float}
+ \newenvironment {scheme*}
+ {\@dblfloat{scheme}}
+ {\end@dblfloat}
+ \bool_if:nTF
+ {
+ \chemmacros_if_class_loaded_p:n {book} ||
+ \chemmacros_if_class_loaded_p:n {report}
+ }
+ {
+ \cs_new_protected:Npn \listofschemes
+ {
+ \chemmacros_tex_if:nTF {@twocolumn}
+ { \@restonecoltrue\onecolumn }
+ { \@restonecolfalse }
+ \chapter* {\listschemename}
+ \@mkboth
+ {\MakeUppercase\listschemename}
+ {\MakeUppercase\listschemename}
+ \@starttoc {los}
+ \chemmacros_tex_if:nT {@restonecol}
+ { \twocolumn }
+ }
+ }
+ {
+ \cs_new_protected:Npn \listofschemes
+ {
+ \section* {\listschemename}
+ \@mkboth
+ {\MakeUppercase\listschemename}
+ {\MakeUppercase\listschemename}
+ \@starttoc {los}
+ }
+ }
+ \cs_new_eq:NN \l@scheme \l@figure
+ \chemmacros_if_package_loaded:nT
+ {floatrow}
+ { \flrow@restyle {scheme} }
+ }
+ }
+ \cs_set:Npn \schemename {\chemmacros_translate:n {#1-name}}
+ \cs_set:Npn \listschemename {\chemmacros_translate:n {#1-list}}
+ }
+
+% --------------------------------------------------------------------------