Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread maxwell

Bernhard--

I'll just comment on one thing, then shut up :-).  It appears you're 
already familiar with LaTeX.  It's possible to convert DocBook to LaTeX 
using the dblatex program (http://dblatex.sourceforge.net/), and you can 
create customizations to take advantage of other LaTeX packages, etc.  
We've used dblatex for over a decade to do grammars; we added a few XML 
schemas + transformations not in standard DocBook for linguistic 
structures.  There was a bit of a learning curve; xslt is definitely my 
un-favorite programming language.  (Andy Black, who may be lurking on 
this list, helped us through the early days.)


   Mike Maxwell
   University of Maryland





-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Bob Stayton

Hi Bernhard,

You said:

> As long as there is no possible was to have a "proprietary"counter 
for structures (as figures) structures do not have anindependent numbering.


The DocBook XSL stylesheets allow for a great deal of customization, so 
it is possible to set up independent counters if you are willing to 
write sufficient code.  In this case, it isn't too hard because there is 
a separate XSL mode used for that called 'label.markup'.  In the 
stylesheet file common/labels.xsl, you will find this template:



  

  
    
  
    
  

  
    
  
    
    
  
    
    
    mode="intralabel.punctuation">

  
    
  
    
    
  
    
  
    
  


When a counter needs to be generated, the stylesheet does 
, and the element matched is 
processed by this template rather than the main template for that 
element.  All it does is output a number label.


Most of the template code is handling whether or not the label contains 
chapter-number or just number. The key line that generates the sequence 
number is:




This instruction is quite flexible and has a long reference page 
describing all the ways its attributes can be combined to do counting.  
One of its attributes that isn't shown is "count", which indicates what 
element is being counted.  It isn't shown here because the default is 
the current context element (that element matched by the template).  The 
count attribute holds  a match expression, so can be written as:


count="d:figure[@condition='chem']"

so then each instance of its application will count only condition="chem"> elements.  You'll need two custom xsl:templates, one 
to match on figure[@condition != 'chem'] and one to match on 
figure[@condition = 'chem']. In each, you have  elements to 
match the condition for counting.


One further complication is the word "Figure" in your language would be 
applied to all of them. To change that will require further customization.


Bob Stayton
Sagehill Enterprises
b...@sagehill.net

On 10/12/2018 6:46 AM, Bernhard Kleine wrote:

Hi, Peter and Thomas,

@Peter: It seems that figure is a valid element, however, the numbering
of figure for structures would conflict with the numbering a normal
figure. As long as there is no possible was to have a "proprietary"
counter for structures (as figures) structures do not have an
independent numbering. I wonder since there are an awful lot of chemical
papers where there is an independent list of structures, that none of
them has been prepared with docbook. Otherwise there would be a solution
already.

@Thomas: since the structures are svg as well as most figure in my book,
I have considered svg. However, than I would lable a contruct of
structures, but not the individual ones. Coming from LaTeX, the
numbering of figures was always a simple use of apropriate macros.

Regards

Bernhard


Am 12.10.2018 um 14:28 schrieb Thomas Schraitle:

Hi,

Am Freitag, 12. Oktober 2018, 14:12:15 CEST schrieb Bernhard Kleine:

In my second mail to this threat a showed a complex table with
structures, arrows labeling etc. I cannot envisage this without a table
structure.

As Dave already pointed out, a table might not be the appropriate way to
layout things.

Have you considered SVG? With SVG (or any other vector format) you can do all
the fancy stuff (arrows, labeling etc.) that you need.






Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Dave Pawson
I.e. Semantically marked up docbook is clearly the wrong tool then.

Dave
On Fri, 12 Oct 2018 at 14:20, Peter Desjardins
 wrote:
>
> I think the table is adding valid semantic structure here. It allows the 
> figure numbering to exist at the Docbook level, not in SVG.
>
> Maybe use  elements inside an ? You could wrap the 
> informaltable in an example to give the entire set of diagrams a title.
>
> Peter
>
>   
> 
>   
> 
>   
>   Chemical One
>   
> 
>   
> 
>   
> 
>
>   
>   Chemical Two
>   
> 
>   
> 
>   
> 
> 
>   
> 
>   
>
>
> On Fri, Oct 12, 2018, 08:28 Thomas Schraitle  wrote:
>>
>> Hi,
>>
>> Am Freitag, 12. Oktober 2018, 14:12:15 CEST schrieb Bernhard Kleine:
>> > In my second mail to this threat a showed a complex table with
>> > structures, arrows labeling etc. I cannot envisage this without a table
>> > structure.
>>
>> As Dave already pointed out, a table might not be the appropriate way to
>> layout things.
>>
>> Have you considered SVG? With SVG (or any other vector format) you can do all
>> the fancy stuff (arrows, labeling etc.) that you need.
>>
>>
>> --
>> Gruß/Regards
>>   Thomas Schraitle
>>
>>
>>
>>
>> -
>> To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
>> For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
>>


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.

-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Thomas Schraitle
Hi,

Am Freitag, 12. Oktober 2018, 15:46:50 CEST schrieb Bernhard Kleine:
> 
> @Peter: It seems that figure is a valid element, however, the numbering
> of figure for structures would conflict with the numbering a normal
> figure. As long as there is no possible was to have a "proprietary"
> counter for structures (as figures) structures do not have an
> independent numbering. I wonder since there are an awful lot of chemical
> papers where there is an independent list of structures, that none of
> them has been prepared with docbook. Otherwise there would be a solution
> already.

As I've pointed out in my last mail (coincidentally sent at the same time), 
you could use .

However, I see the following solutions in regards to numbering:

1. Use  or 
   Pros:
* if the book doesn't contain any normal equation, it's easy to apply
* no schema customization
* no stylesheet customization needed

   Cons:
* Not sure if you want to label your chemical structure as "Equation"
  (can be fixed)
* More stylesheet customization is needed, if you need to distinguish
  between numbering of a normal equation and numbering of a chemical
  structure
 
2. Use 
   Same as equation, it's just a matter of taste which one do you prefer.
   The same pros and cons apply.

3. Create your own element (?); creating DocBook RNG customization
   Pro:
* free to design what structure you really need
* easy with the help of RELAX NG
* independent of any numbering of figure or equation

   Cons:
* not be DocBook compatible anymore; to validate, you need your
  own schema
* you need to write a customization layer for the DocBook XSL
  stylesheets


I hope I haven't misunderstood your ideas. Does that make sense?

 
> @Thomas: since the structures are svg as well as most figure in my book,
> I have considered svg. However, than I would lable a contruct of
> structures, but not the individual ones. Coming from LaTeX, the
> numbering of figures was always a simple use of apropriate macros.

I also come from a LaTeX background. ;)


-- 
Gruß/Regards
  Thomas Schraitle




-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Bernhard Kleine
Hi, Peter and Thomas,

@Peter: It seems that figure is a valid element, however, the numbering
of figure for structures would conflict with the numbering a normal
figure. As long as there is no possible was to have a "proprietary"
counter for structures (as figures) structures do not have an
independent numbering. I wonder since there are an awful lot of chemical
papers where there is an independent list of structures, that none of
them has been prepared with docbook. Otherwise there would be a solution
already.

@Thomas: since the structures are svg as well as most figure in my book,
I have considered svg. However, than I would lable a contruct of
structures, but not the individual ones. Coming from LaTeX, the
numbering of figures was always a simple use of apropriate macros.

Regards

Bernhard


Am 12.10.2018 um 14:28 schrieb Thomas Schraitle:
> Hi,
>
> Am Freitag, 12. Oktober 2018, 14:12:15 CEST schrieb Bernhard Kleine:
>> In my second mail to this threat a showed a complex table with
>> structures, arrows labeling etc. I cannot envisage this without a table
>> structure.
> As Dave already pointed out, a table might not be the appropriate way to 
> layout things.
>
> Have you considered SVG? With SVG (or any other vector format) you can do all 
> the fancy stuff (arrows, labeling etc.) that you need.
>
>

-- 
spitzhalde9
D-79853 lenzkirch
bernhard.kle...@gmx.net
www.b-kleine.com, www.urseetal.net
-
thunderbird mit enigmail
GPG schlüssel: D5257409
fingerprint:
08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09




signature.asc
Description: OpenPGP digital signature


Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Thomas Schraitle
Hi,

Am Freitag, 12. Oktober 2018, 15:19:59 CEST schrieb Peter Desjardins:
> I think the table is adding valid semantic structure here. It allows the
> figure numbering to exist at the Docbook level, not in SVG.
> 
> Maybe use  elements inside an ? You could wrap the
> informaltable in an example to give the entire set of diagrams a title.

Thanks for your reply Peter. I'm sorry, but I have to disagree. :)

If Bernhard tries to display chemical structures, why using an overly 
complicated structure? KISS (keep it simple, stupid)! ;) I see no benefit in 
using a table here. Even the opposite: tables on mobile devices (EPUB) can 
have issues. It's better to avoid them.

Even if you go from simple chemical structure to a chemical reaction, there is 
even no reason to split it into several pieces. A structure---and so a 
reaction---belongs together IMHO. With the features of SVG, it's possible.

As DocBook doesn't provide a element for chemical structures, you need either 
use figure or equation (as Jirka pointed out). For example:

 
Steran

   
  
   
   
  Steran...
   

 

IMHO, this is totally enough. Put everything in steran.svg what you need: 
labeling, text, arrows, etc.

With the @condition attribute, you can distinguish a chemical structure from a 
"normal" equation (if you need to).

Even if you really have to use subfigures for a chemical structure I would 
avoid table structures at all costs. For example, if you need to have two 
subfigures, you could use two mediaobjects:

 
Steran A and B

   
  
   
   
  Steran A...
   


   
  
   
   
  Steran B...
   

 

Of course, you need to delegate the layout to the stylesheet and you need to 
write a customization layer. For FO it can be rendered indeed as a table and 
for HTML there are different (CSS) methods to position two objects side by 
side.


-- 
Gruß/Regards
  Thomas Schraitle




-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Peter Desjardins
I think the table is adding valid semantic structure here. It allows the
figure numbering to exist at the Docbook level, not in SVG.

Maybe use  elements inside an ? You could wrap the
informaltable in an example to give the entire set of diagrams a title.

Peter

  

  

  
  Chemical One
  

  

  


  
  Chemical Two
  

  

  


  

  


On Fri, Oct 12, 2018, 08:28 Thomas Schraitle  wrote:

> Hi,
>
> Am Freitag, 12. Oktober 2018, 14:12:15 CEST schrieb Bernhard Kleine:
> > In my second mail to this threat a showed a complex table with
> > structures, arrows labeling etc. I cannot envisage this without a table
> > structure.
>
> As Dave already pointed out, a table might not be the appropriate way to
> layout things.
>
> Have you considered SVG? With SVG (or any other vector format) you can do
> all
> the fancy stuff (arrows, labeling etc.) that you need.
>
>
> --
> Gruß/Regards
>   Thomas Schraitle
>
>
>
>
> -
> To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org
>
>


Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Thomas Schraitle
Hi,

Am Freitag, 12. Oktober 2018, 14:12:15 CEST schrieb Bernhard Kleine:
> In my second mail to this threat a showed a complex table with
> structures, arrows labeling etc. I cannot envisage this without a table
> structure.

As Dave already pointed out, a table might not be the appropriate way to 
layout things.

Have you considered SVG? With SVG (or any other vector format) you can do all 
the fancy stuff (arrows, labeling etc.) that you need.


-- 
Gruß/Regards
  Thomas Schraitle




-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Bernhard Kleine
In my second mail to this threat a showed a complex table with
structures, arrows labeling etc. I cannot envisage this without a table
structure.

Bernhard


Am 12.10.2018 um 14:06 schrieb Dave Pawson:

> I might question if the table (as layout) is necessary for your purposes?
>   That would allow more flexibility in markup?
> Dave
> On Fri, 12 Oct 2018 at 12:57, Bernhard Kleine  wrote:
>> Hi Jirka,
>>
>> This works but raises an error: equation must not occur among the
>> children or descendants of table
>>
>> It transforms anyhow.
>>
>> Thanks for the hint.
>>
>> Bernhard
>>
>>
>> Am 11.10.2018 um 16:45 schrieb Jirka Kosek:
>>> On 11.10.2018 16:26, Bernhard Kleine wrote:
 unfortunately, using figures does not work in my example for the
 following reasons. It seems not possible to arrange a couple of figure
 inside a table: I show to you an example of a table containing
 structures and errors and labelling:
>>> You can use  element for this. It can appear almost anywhere
>>> in block context.
>>>
>> --
>> spitzhalde9
>> D-79853 lenzkirch
>> bernhard.kle...@gmx.net
>> www.b-kleine.com, www.urseetal.net
>> -
>> thunderbird mit enigmail
>> GPG schlüssel: D5257409
>> fingerprint:
>> 08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09
>>
>>
>

-- 
spitzhalde9
D-79853 lenzkirch
bernhard.kle...@gmx.net
www.b-kleine.com, www.urseetal.net
-
thunderbird mit enigmail
GPG schlüssel: D5257409
fingerprint:
08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09




signature.asc
Description: OpenPGP digital signature


Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Dave Pawson
I might question if the table (as layout) is necessary for your purposes?
  That would allow more flexibility in markup?
Dave
On Fri, 12 Oct 2018 at 12:57, Bernhard Kleine  wrote:
>
> Hi Jirka,
>
> This works but raises an error: equation must not occur among the
> children or descendants of table
>
> It transforms anyhow.
>
> Thanks for the hint.
>
> Bernhard
>
>
> Am 11.10.2018 um 16:45 schrieb Jirka Kosek:
> > On 11.10.2018 16:26, Bernhard Kleine wrote:
> >> unfortunately, using figures does not work in my example for the
> >> following reasons. It seems not possible to arrange a couple of figure
> >> inside a table: I show to you an example of a table containing
> >> structures and errors and labelling:
> > You can use  element for this. It can appear almost anywhere
> > in block context.
> >
>
> --
> spitzhalde9
> D-79853 lenzkirch
> bernhard.kle...@gmx.net
> www.b-kleine.com, www.urseetal.net
> -
> thunderbird mit enigmail
> GPG schlüssel: D5257409
> fingerprint:
> 08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09
>
>


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.

-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-12 Thread Bernhard Kleine
Hi Jirka,

This works but raises an error: equation must not occur among the
children or descendants of table

It transforms anyhow.

Thanks for the hint.

Bernhard


Am 11.10.2018 um 16:45 schrieb Jirka Kosek:
> On 11.10.2018 16:26, Bernhard Kleine wrote:
>> unfortunately, using figures does not work in my example for the
>> following reasons. It seems not possible to arrange a couple of figure
>> inside a table: I show to you an example of a table containing
>> structures and errors and labelling:
> You can use  element for this. It can appear almost anywhere
> in block context.
>

-- 
spitzhalde9
D-79853 lenzkirch
bernhard.kle...@gmx.net
www.b-kleine.com, www.urseetal.net
-
thunderbird mit enigmail
GPG schlüssel: D5257409
fingerprint:
08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09




signature.asc
Description: OpenPGP digital signature


Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-11 Thread Jirka Kosek
On 11.10.2018 16:26, Bernhard Kleine wrote:
> unfortunately, using figures does not work in my example for the
> following reasons. It seems not possible to arrange a couple of figure
> inside a table: I show to you an example of a table containing
> structures and errors and labelling:

You can use  element for this. It can appear almost anywhere
in block context.

-- 
--
  Jirka Kosek  e-mail: ji...@kosek.cz  http://xmlguru.cz
--
 Professional XML and Web consulting and training services
DocBook/DITA customization, custom XSLT/XSL-FO document processing
--
Bringing you XML Prague conferencehttp://xmlprague.cz
--



signature.asc
Description: OpenPGP digital signature


Re: [docbook-apps] How to make chemical structure automatically numbered

2018-10-11 Thread Peter Desjardins
Hi, Bernhard.

It sounds like you should be using the formal title numbering behavior
of one of the existing elements like example or figure. I hope I'm not
misunderstanding, is your problem that you are using those elements
already, and you need a custom formal element to hold *only* chemical
structure figures?

I think that if you use the formal  element to hold your
chemical structure SVG diagrams, you should be able to use the default
formal title numbering behavior of  to automatically number
those figures. You can do things like generate a list of figures and
customize the words in the figure numbering (for example, "Chemical
structure #: Steran Backbone").

I'm surprised that the  element in your example isn't numbered
in the way you want though.

Here are some pages from Bob Stayton's DocBook XSL guide:

http://www.sagehill.net/docbookxsl/FormalTitles.html#FormalNumbering
http://www.sagehill.net/docbookxsl/TOCcontrol.html#TOCcomponents (if
you wanted a list of figures at the start of a book or chapter)

For example, I use figure elements like the one I pasted below. Good luck!

Peter


http://docbook.org/ns/docbook;>
  
Test
  

  
Steran Backbone


  

  

  
Steran
  

  

On Thu, Oct 11, 2018 at 12:46 AM Bernhard Kleine
 wrote:
>
> Hi,
>
> this is for sure not the first instance of numbering chemical structure 
> automatically during docbook transformation for print. But I can not find an 
> example to learn from.
>
> I have the following example (of about 100 structures in my book). I want 
> have these structures numbered with a bold number and automatically. I was 
> told by Thomas Schaitle, this can be done by xsl. In "docbook xsl", I do not 
> find an example. Chemical structures in my book are characterized by 
> property="chemical". What is needed is
>
> make a individual number for each structure
> avoid numbering doubly if a structure is shown again
> generate the xreflabel with this number that the xref references find a 
> target.
>
> BTW, if I generate an xreflabel by hand then these structures are correctly 
> numbered. However, to be able to change the sequential arrangement of 
> structures and still have the structures labeld sequentially, it is desirable 
> to number them automatically. Please give me an example how to proceed. I 
> have attached the svg file with the structure.
>
> Regards
>
> Bernhard
>
> 
> http://docbook.org/xml/5.1/rng/docbook.rng; 
> schematypens="http://relaxng.org/ns/structure/1.0;?>
> http://docbook.org/xml/5.1/sch/docbook.sch; 
> type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron;?>
> http://docbook.org/ns/docbook;
> xmlns:xlink="http://www.w3.org/1999/xlink; version="5.1">
> 
> polycyclic steran ( role="chem.ref"/>)
>  xreflabel="Kap6.F:Steran">
> Sterane Backbone
> 
> 
> 
> 
> Steran
> 
> 
>  xml:id="chem.steran">
> 
>  width="3.8cm"/>
> 
> 
> 
> 
>  linkend="chem.steran"/>
> 
> 
> 
> 
>
> 
>
>
> --
> spitzhalde9
> D-79853 lenzkirch
> bernhard.kle...@gmx.net
> www.b-kleine.com, www.urseetal.net
> -
> thunderbird mit enigmail
> GPG schlüssel: D5257409
> fingerprint:
> 08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09

-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



[docbook-apps] How to make chemical structure automatically numbered

2018-10-10 Thread Bernhard Kleine
Hi,

this is for sure not the first instance of numbering chemical structure
automatically during docbook transformation for print. But I can not
find an example to learn from.

I have the following example (of about 100 structures in my book). I
want have these structures numbered with a bold number and
automatically. I was told by Thomas Schaitle, this can be done by xsl.
In "docbook xsl", I do not find an example. Chemical structures in my
book are characterized by property="chemical". What is needed is

 1. make a individual number for each structure
 2. avoid numbering doubly if a structure is shown again
 3. generate the xreflabel with this number that the xref references
find a target.

BTW, if I generate an xreflabel by hand then these structures are
correctly numbered. However, to be able to change the sequential
arrangement of structures and still have the structures labeld
sequentially, it is desirable to number them automatically. Please give
me an example how to proceed. I have attached the svg file with the
structure.

Regards

Bernhard


http://docbook.org/xml/5.1/rng/docbook.rng;
schematypens="http://relaxng.org/ns/structure/1.0;?>
http://docbook.org/xml/5.1/sch/docbook.sch;
type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron;?>
http://docbook.org/ns/docbook;
    xmlns:xlink="http://www.w3.org/1999/xlink; version="5.1">
    
    polycyclic steran ()
    
    Sterane Backbone
    
    
    
    
    Steran
    
    
    
    
    
    
    
    
    
    
    
    
    
    
   



-- 
spitzhalde9
D-79853 lenzkirch
bernhard.kle...@gmx.net
www.b-kleine.com, www.urseetal.net
-
thunderbird mit enigmail
GPG schlüssel: D5257409
fingerprint:
08 B7 F8 70 22 7A FC C1 15 49 CA A6 C7 6F A0 2E D5 25 74 09



signature.asc
Description: OpenPGP digital signature