I have a latex file that i wish to convert into an html document. It is made up of many sub-files with a master document. I want to hyperlink different parts/sections of these files(included/master-file) among themselves just like a wiki.
-
Are you aware of this: https://tex.stackexchange.com/q/14364/121799 ? (BTW, are you left-handed or right-handed? ;-) – Feb 02 '19 at 03:45
-
I wish to create a wiki like http://hyperphysics.phy-astr.gsu.edu/hbase/quacon.html#quacon – neutrino Feb 02 '19 at 07:39
1 Answers
You can put chapters or sections to standalone pages using a command line option. The hyperlinks can be added using the \nameref command provided by the Hyperref package. It is based on the standard label/ref mechanism.
You didn't provide any example, so here is my MWE, sample.tex:
\documentclass{book}
\usepackage{lipsum}
\usepackage{hyperref}
\title{Site title}
\author{Neutrino}
\begin{document}
\maketitle
\input{hello-world}
\input{another-section}
\end{document}
It includes two files, hello-world.tex:
\chapter{Hello world}
\label{chap:hello-world}
\lipsum
The second file is named another-section.tex:
\chapter{Another section}
\label{chap:another-section}
We can try to link to chapter~\nameref{chap:hello-world}.
\lipsum
You can see the \nameref command use here.
Compile the document using the following command:
make4ht sample.tex "2,sec-filename"
The options after the filename require cutting of chapters to standalone HTML files. The names of the generated files will be based on the chapter titles. This feature is enabled using the sec-filename option.
The sample.html will contain title and table of contents:
The file Anothersection.html contains link to the Hello world chapter:
- 50,697
-
make4ht command does not work on my system as it is broken in my texlive 2018https://github.com/michal-h21/make4ht/issues/12. Is there an alternative with htlatex. – neutrino Feb 04 '19 at 10:01
-
I have accomplished my task by compiling each tex files to be included in final wiki separately/batch command(htlatex?) and linking each of them by using \href{url}. – neutrino Feb 04 '19 at 10:28
-
@neutrino make4ht should be fixed in TL 2018, it just needs to be updated using
tlmgr update --all– michal.h21 Feb 04 '19 at 10:31 -
-
@neutrino the htlatex call would be
htlatex sample.tex "xhtml,2,sec-filename"– michal.h21 Feb 07 '19 at 12:14

