Skip to content
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
Closed

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

siegfriedzoetzsche opened this issue Jul 26, 2018 · 1 comment

Comments

@siegfriedzoetzsche
Copy link

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{}

@brucemiller
Copy link
Owner

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!

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

No branches or pull requests

3 participants