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

bold and italic markup is sometimes lost in index terms #1023

Closed
siegfriedzoetzsche opened this Issue Jul 26, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@siegfriedzoetzsche

siegfriedzoetzsche commented Jul 26, 2018

When converting

\documentclass{article}
\begin{document}

\textbf{BOLD\index{NORMAL}}

\textbf{BOLD\index{\textbf{BOLD}}}

\textbf{BOLD\index{\textit{ITALIC}}}

\textit{ITALIC\index{NORMAL}}

\textit{ITALIC\index{\textbf{BOLD}}}

\textit{ITALIC\index{\textit{ITALIC}}}

{NORMAL\index{NORMAL}}

{NORMAL\index{\textbf{BOLD}}}

{NORMAL\index{\textit{ITALIC}}}

\end{document}

with LaTeXML version 0.8.2; revision 48de2c4

latexml --nocomments test.tex

I get

[...]
  <para xml:id="p1">
    <p><text font="bold">BOLD<indexmark>
          <indexphrase key="NORMAL">NORMAL</indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p2">
    <p><text font="bold">BOLD<indexmark>
          <indexphrase key="BOLD">BOLD</indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p3">
    <p><text font="bold">BOLD<indexmark>
          <indexphrase key="ITALIC"><text font="italic">ITALIC</text></indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p4">
    <p><text font="italic">ITALIC<indexmark>
          <indexphrase key="NORMAL">NORMAL</indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p5">
    <p><text font="italic">ITALIC<indexmark>
          <indexphrase key="BOLD"><text font="bold">BOLD</text></indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p6">
    <p><text font="italic">ITALIC<indexmark>
          <indexphrase key="ITALIC">ITALIC</indexphrase>
        </indexmark></text></p>
  </para>
  <para xml:id="p7">
    <p>NORMAL
<indexmark>
        <indexphrase key="NORMAL">NORMAL</indexphrase>
      </indexmark></p>
  </para>
  <para xml:id="p8">
    <p>NORMAL
<indexmark>
        <indexphrase key="BOLD"><text font="bold">BOLD</text></indexphrase>
      </indexmark></p>
  </para>
  <para xml:id="p9">
    <p>NORMAL
<indexmark>
        <indexphrase key="ITALIC"><text font="italic">ITALIC</text></indexphrase>
      </indexmark></p>
  </para>
[...]

In <para xml:id="p2"> we have

<indexphrase key="BOLD">BOLD</indexphrase>

while in <para xml:id="p5"> and <para xml:id="p8"> we have

<indexphrase key="BOLD"><text font="bold">BOLD</text></indexphrase>

Also how would one distinguish <para xml:id="p1"> from <para xml:id="p2">?

I am not sure what the expected behaviour would be. Depending on whether text[@font='bold']/indexmark/indexphrase/text() is supposed to inherit the boldness from the text ancestor I would expect

<indexphrase key="NORMAL"><text font="medium">NORMAL</text></indexphrase>

in <para xml:id="p1"> or

<indexphrase key="BOLD"><text font="bold">BOLD</text></indexphrase>

in <para xml:id="p2">.

italic markup shows an analog problem. I have not tested with \emph{}

@dginev dginev added this to the LaTeXML-0.8.4 milestone Jul 26, 2018

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Jul 27, 2018

Normally, you want that inheritance (which was hard enough to get right in LaTeXML! :> ). But in the case of metadata like \index which gets pulled out of its context and used elsewhere, it both needs to restart from a default font, and record it's own font standalone. I couldn't quite solve this without creating (yet) another magic attribute _standalone_font which marks elements which need this treatment. I think this should work now, w/o (seemingly) cluttering up the common cases. Thanks for the report!

@dginev dginev modified the milestones: LaTeXML-0.8.4, LaTeXML-0.8.3 Jul 27, 2018

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