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

author name splitting fails in some cases when converting a bib-file with latexml #999

Closed
siegfriedzoetzsche opened this Issue May 24, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@siegfriedzoetzsche

siegfriedzoetzsche commented May 24, 2018

When a bib-File is converted with latexml, the name splitting of the author filed fails in some cases.

Converting the bib file example.bib:

@book{example0,
author = {
Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxiiiii and Yyy Yyy
},}
@book{example1,
author = {
Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxi and Yyy Yyy
},}
@book{example2,
author = {
Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxii and Yyy Yyy
},}
@book{example3,
author = {
Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxx and Yyy Yyy
},}

with

latexml --destination=example.xml example.bib

produces a correct result only for entry example0.
For entry example1 the second author is messed up and the third is missing.
For entry example2 the second author is messed up.
For entry example3 the third author is messed up.

[...]
    <biblist>
      <bibentry key="example0" type="book" xml:id="bib.bib1">
        <bib-name role="author">
          <surname>Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz</surname>
          <givenname>Ab</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>Xxxxxxxxiiiii</surname>
          <givenname>Xxxx</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>Yyy</surname>
          <givenname>Yyy</givenname>
        </bib-name>
        <bib-data role="self" type="BibTeX">@book{example0,
    author = {Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxiiiii and Yyy Yyy}}
</bib-data>
      </bibentry>
      <bibentry key="example1" type="book" xml:id="bib.bib2">
        <bib-name role="author">
          <surname>Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz</surname>
          <givenname>Ab</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>and</surname>
          <givenname>Xxxx Xxxxxxxxi</givenname>
        </bib-name>
        <bib-data role="self" type="BibTeX">@book{example1,
    author = {Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxi and Yyy Yyy}}
</bib-data>
      </bibentry>
      <bibentry key="example2" type="book" xml:id="bib.bib3">
        <bib-name role="author">
          <surname>Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz</surname>
          <givenname>Ab</givenname>
        </bib-name>
        <bib-name role="author">
          <surname/>
          <givenname>Xxxx Xxxxxxxxii</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>Yyy</surname>
          <givenname>Yyy</givenname>
        </bib-name>
        <bib-data role="self" type="BibTeX">@book{example2,
    author = {Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxxii and Yyy Yyy}}
</bib-data>
      </bibentry>
      <bibentry key="example3" type="book" xml:id="bib.bib4">
        <bib-name role="author">
          <surname>Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz</surname>
          <givenname>Ab</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>Xxxxxxxx</surname>
          <givenname>Xxxx</givenname>
        </bib-name>
        <bib-name role="author">
          <surname>Yyy</surname>
          <givenname/>
        </bib-name>
        <bib-data role="self" type="BibTeX">@book{example3,
    author = {Ab Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz and Xxxx Xxxxxxxx and Yyy Yyy}}
</bib-data>
      </bibentry>
    </biblist>
[...]

I suspect this has something to do with the % inserted by sub UnTeX in Core/Token.pm after the 78th character (my $UNTEX_LINELENGTH = 78; # [CONSTANT]), similar to #884 .

A quick fix for me is to add $string =~ s/%\n//; in sub splitWords in Package/BibTeX.pool.ltxml like:

sub splitWords {
  my ($string) = @_;
  $string =~ s/\\~/####/g;    # Protect \~ so we can split on hard spaces (~) as well as regular ones.
  my @words = ();
  $string =~ s/^[\s~]+//;
  $string =~ s/%\n//;
[...]
  }

@dginev dginev added this to the LaTeXML-0.8.4 milestone May 24, 2018

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Jun 5, 2018

Nice debugging! Thanks; fixed now!!

@brucemiller brucemiller closed this Jun 5, 2018

@dginev dginev modified the milestones: LaTeXML-0.8.4, LaTeXML-0.8.3 Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment