nielsthl / QaDiL

Quick and Dirty interactive LaTeX. A collection of python programs for translation of LaTeX with interactive extensions into html.
https://nielsthl.github.io/QaDiL
MIT License
6 stars 3 forks source link

Use parenthesis in enumeration, rather than punctuation #39

Open gardeAU opened 9 months ago

gardeAU commented 9 months ago

When using \begin{enumerate}[(i)] .. \end{enumerate}, the list is given as

i. ii. iii.

I would prefer the arguably more standard style:

(i) (ii) (iii)

Could someone point me in the right direction? I have looked in Enumerate.py, and I assume it is related to the itemizetype = ' "lowerroman" ' in line 125, but I have not had any luck with modifications.

nielsthl commented 9 months ago

This is tricky and in fact an html issue. The standard html output for number items in <ol>...</ol> is a number (appearing as a suitable numeral) followed be a period. A solution could be to use

<style>
ol {
    list-style-type: none; 
}
</style>

and hard code in python the desired format resulting in for example

<ol>
    <li>(i) A</li>
    <li>(ii) B</li>
    <li>(iii) C</li>
</ol>

We should discuss how big of a subset of html we want to use.

gardeAU commented 7 months ago

After a bit of digging online, I found a quite easy fix for this. In iLaTeXen.css, where ol.alpha and so on is defined, replace those parts with:

@counter-style paren-decimal { system: extends decimal; prefix: "("; suffix: ") "; }

@counter-style paren-lower-greek { system: extends lower-greek; prefix: "("; suffix: ") "; }

@counter-style paren-lower-alpha { system: extends lower-alpha; prefix: "("; suffix: ") "; }

@counter-style paren-upper-roman { system: extends upper-roman; prefix: "("; suffix: ") "; }

@counter-style paren-lower-roman { system: extends lower-roman; prefix: "("; suffix: ") "; }

ol.alpha { list-style-type: paren-lower-alpha; }

ol.greek { list-style-type: paren-lower-greek; }

ol.number { list-style-type: paren-decimal; }

ol.lowerroman { list-style-type: paren-lower-roman; }

ol.upperroman { list-style-type: paren-upper-roman; }

nielsthl commented 7 months ago

Very nice! Please submit pull request with updated QaDi/qadil/css/iLaTeXen,css perhaps commenting out:

ol.alpha {
    list-style-type: lower-alpha;
}

ol.greek {
    list-style-type: lower-greek;
}

ol.number {
    list-style-type: decimal;
}

ol.lowerroman {
    list-style-type: lower-roman;
}

ol.upperroman {
    list-style-type: upper-roman;
}
nielsthl commented 2 months ago

Also, one must delete the "." in self.baselabel in Enumerate.py to make labels appear right in \ref.