[tex4ht] Small caps: LibreOffice

Michal Hoftich michal.h21 at gmail.com
Sat Aug 23 01:09:22 CEST 2014


Hi Guido,

this issue occurs even in HTML for me, when I try to use `\textsc`
command. After some research I've found that this issue is caused by
tex4ht font configurations (.htf files) and also that this was for
some reason intentional behavior, because in  "The LaTeX Web
companion" book, there is a paragraph about small caps and explicit
example that \textsc{a} is converted as `<span
class="small-caps">A</span>`.

Because you didn't post any example, I created simple file:

----------
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}

\textsc{Příliš žluťoučký kůň úpěl ďábelské ódy}
\end{document}
---------

This is showed in the browser:

---
PříLIš žLUťOUčKý KŮň úPěL ďáBELSKé óDY
---

So unaccented lowercase letters are converted to uppercase, accented
letters remain untouched. When I looked to the html code, things
weren't nice:

---------

span
class="eccc-1000">P</span><span
class="eccc-1000">&#x0159;</span><span
class="eccc-1000">í<span
class="small-caps">L</span><span
class="small-caps">I</span></span><span
class="eccc-1000">š </span><span
class="eccc-1000">ž<span
---

uppercased letters have class "small-caps", which would be displayed
as small caps, if it weren't uppercase letters. Accented characters
have class "eccc-1000", which doesn't have any css declaration, so it
doesn't show as small caps either.


With the help of a config file, I was able to clean this mess:

-------
\Preamble{xhtml}
\Configure{textsc}{\ifvmode\ShowPar\fi\NoFonts\HCode{<span
class="sc">}}{\Tg</span>\EndNoFonts}
\Css{.sc{ font-variant: small-caps;}}
\begin{document}
\EndPreamble
--------

<span class="sc">PříLIš žLUťOUčKý KŮň úPěL ďáBELSKé óDY</span>

lowercase letters are in small caps, prima.

we need to solve uppercase issue now. In tex4ht log I found.

-----
(/opt/texlive/2013/texmf-dist/fonts/tfm/jknappen/ec/eccc1000.tfm)
(/opt/texlive/2013/texmf-dist/tex4ht/ht-fonts/alias/ec/eccc.htf)
Searching `ec-iwonacap.htf' for `eccc1000.htf'
(/opt/texlive/2013/texmf-dist/tex4ht/ht-fonts/unicode/iwona/ec-iwonacap.htf)
-----

as far as I understand this, file `ec-iwonacap.htf` is used to convert
text in small caps in out document. I copied this file to the current
working directory and opened it. I wrote something about htf files
here:

http://tex.stackexchange.com/a/161614/2891

I found positions of lowercase letters and their uppercase
counterparts were ised instead. I translated them back to lowercase
and saved the file:

---
'a' '4'  97
'b' '4'  98
'c' '4'  99
'd' '4'  100
'e' '4'  101
'f' '4'  102
'g' '4'  103
'h' '4'  104
'i' '4'  105
'j' '4'  106
'k' '4'  107
'l' '4'  108
'm' '4'  109
'n' '4'  110
'o' '4'  111
'p' '4'  112
'q' '4'  113
'r' '4'  114
's' '4'  115
't' '4'  116
'u' '4'  117
'v' '4'  118
'w' '4'  119
'x' '4'  120
'y' '4'  121
'z' '4'  122
---

After compilation, correct small caps appeared.

Then I compiled the file with oolatex and small caps were used
correctly even in libre office.

Several interesting questions about default font handling come to my
mind, I will get back to them tommorow, I have to go sleep now.

Best regards,

Michal

2014-08-22 10:45 GMT+02:00 Guido Milanese <guido.milanese at inbox.com>:
> I tried to find a discussion about this point but I did not succeed -- my
> apologies if this has been already dealt with.
> I use tex4ht to convert to MsWord /via/ LibreOffice, and it's all right:
> particularly now that there are no problems with Biblatex, I am very
> grateful... every day. I have a minor problem. In many bibliography formats
> author names must be printed in small caps. Converting to HTML/XML it's all
> right, but the ODT output features small caps but all the letters are
> uppercase letters. In order to get a proper output I must select the word
> and capitalise only the first letter. Not a big deal, I can do it with a
> macro that executes ChangeCase-->CapitaliseEveryWord, but I just wished to
> see if I am doing something wrong.
> I tried both with this command line:
>
> htlatex $1 "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo" "-cvalidate"
>
> and with
>
> mk4ht oolatex $1
>
> I am on xubuntu 13.10. mk4ht Version 1.1. tex4ht.c 2012-07-25-19:36
>
> Thank you very much for your kind attention.
> Guido Milanese, Italy
>
>



More information about the tex4ht mailing list