[tex4ht] TOC as an HTML aside

Michal Hoftich michal.h21 at gmail.com
Wed Jun 1 12:48:25 CEST 2016


Hi Hans,

>
> I would like to see the table of contents of my TeX document displayed
> as some kind of navigation menu, probably as an HTML aside in a fixed
> position on the side of the page.  I am sure I can hack it up with a
> bit of scripting, but I am not sure which is the best approach to start.
>

you can create such navigational menu using simple CSS:

\Preamble{xhtml}
\Css{body{max-width:40em;margin:0 auto;}}
\Css{.tableofcontents{float:left;width:10em;margin-left:-12em;position:fixed;}}
\Css{@media (max-width:64em){
   .tableofcontents{float:none;width:100\%;margin-left:0;position:normal;}}}
\begin{document}
\let\contentsname\empty
\EndPreamble

This will make centered document with sidepanel, which will collapse
when the browser windows is too small.

With scripting, you can create something more interesting see:

https://github.com/michal-h21/tex4ht-enhanced-web
http://tex.stackexchange.com/a/239944/2891

Best regards,
Michal


More information about the tex4ht mailing list