1

Is there any way to convert my (LuaLaTex + MakeIndex + BibTex) main.tex from MikTex file to html or docx?

I've tried this https://tex.stackexchange.com/a/73092/189401 but it's not what I want.

These are the packages I'm importing in the preamble:

\documentclass[12pt, a4paper]{article}

\usepackage{fontspec}

\setmainfont{Times New Roman}

\usepackage{setspace}

\setlength{\topmargin}{-2.5cm}

\usepackage[top=2.50cm, bottom=2.50cm, left=3.00cm, right=2.00cm]{geometry}

\setcounter{tocdepth}{4}

\setcounter{secnumdepth}{4}

\usepackage{fancyhdr}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

\pagestyle{fancy}

\fancyhf{} 

\rfoot{\thepage} 

\renewcommand{\headrulewidth}{0pt} 

\usepackage[LGR, T1]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage[english,greek]{babel} 

\usepackage[unicode, linktoc=all]{hyperref} 

\usepackage{mwe}

\usepackage{graphicx} 

\graphicspath{{images/}} 

\usepackage{easyfig}

\usepackage{float}

\usepackage{cleveref}

\crefname{figure}{figure}{figures}

\Crefname{figure}{Figure}{Figures} 

\hypersetup{colorlinks=true, linkcolor=black, urlcolor=black, citecolor=black}

\usepackage[bibencoding=auto,backend=bibtex,autolang=other,sorting=none]{biblatex}

\renewcommand\bibliographystyle{unsrtnat}

\usepackage{csquotes} 

\addbibresource{bib.bib} 

\usepackage{multirow}

\usepackage{tabularx}

\usepackage{tabulary}

\usepackage[12pt]{moresize} 

\usepackage{abstract} 

\renewcommand{\abstractnamefont}{\normalfont\large}

\renewcommand{\abstracttextfont}{\normalfont\normalsize}


\usepackage[toc,page]{appendix}

\usepackage{xcolor} 

\usepackage{import} 

\begin{document}
  • there are many convertors, latexml, tex4ht, lwarp, ... but whether they work with luatex depends in some cases how much lua you are using, and you give no clues. also saying "not what you want" does not tell anyone what you do want. – David Carlisle May 21 at 12:48
  • you can also simply import the generated pdf into word and see what it does (I am told) – David Carlisle May 21 at 12:48
  • make4ht -ul filename.tex for html or make4ht -ulf odt filename.tex for ODT. You will need to configure it for makeindex and bibtex. it is impossible to say anything more without some additional inforamtion about problems you encountered and especially a code sample – michal.h21 May 21 at 13:02
  • I've tried what you said, but it says that it can't read my figures. – Dionisis Stefanopoulos May 22 at 7:09
  • I need a full example including the figure code and the error messages from the command line output. common issue may be that you don't use filename extensions in the \includegraphics command. see tex.stackexchange.com/a/213473/2891 for a fix. – michal.h21 May 22 at 7:33
1

OK, I've added some sample code to your example and tried it with make4ht. It compiles mostly OK, I've just had to remove few unnecessary packages (don't use fontenc and inputenc together with fontspec, also, don't use BibTeX commands with BibLaTeX)

Here is the modified example:

\documentclass[12pt, a4paper]{article}

\usepackage{fontspec}

% \setmainfont{Times New Roman}

\usepackage{setspace}

\setlength{\topmargin}{-2.5cm}

\usepackage[top=2.50cm, bottom=2.50cm, left=3.00cm, right=2.00cm]{geometry}

\setcounter{tocdepth}{4}

\setcounter{secnumdepth}{4}

\usepackage{fancyhdr}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

\pagestyle{fancy}

\fancyhf{} 

\rfoot{\thepage} 

\renewcommand{\headrulewidth}{0pt} 

% \usepackage[LGR, T1]{fontenc}

% \usepackage[utf8]{inputenc}

\usepackage[greek,english]{babel} 

\usepackage[unicode, linktoc=all]{hyperref} 

\usepackage{mwe}

\usepackage{graphicx} 

\graphicspath{{images/}} 

\usepackage{easyfig}

\usepackage{float}

\usepackage{cleveref}

\crefname{figure}{figure}{figures}

\Crefname{figure}{Figure}{Figures} 

\hypersetup{colorlinks=true, linkcolor=black, urlcolor=black, citecolor=black}

\usepackage[bibencoding=auto,backend=biber,autolang=other,sorting=none]{biblatex}

% \renewcommand\bibliographystyle{unsrtnat}

\usepackage{csquotes} 

\addbibresource{biblatex-examples.bib} 

\usepackage{multirow}

\usepackage{tabularx}

\usepackage{tabulary}

\usepackage[12pt]{moresize} 

\usepackage{abstract} 

\renewcommand{\abstractnamefont}{\normalfont\large}

\renewcommand{\abstracttextfont}{\normalfont\normalsize}


\usepackage[toc,page]{appendix}

\usepackage{xcolor} 

\usepackage{import} 
\usepackage{makeidx}
\makeindex

\begin{document}
Hello world. Some indexing.
\index{hello}
\index{hello!Peter}
\index{Jenny|textbf}

Some citation \cite{gillies}

\printbibliography
\printindex
\end{document}

The index and bibliography creation can be automated using make4ht build file. It needs the development version of make4ht for the correct index. Save the following code as mybuild.lua:

if mode=="draft" then
Make:htlatex {}
else
Make:htlatex {}
Make:xindy {}
Make:biber {}
Make:htlatex {}
end

The document can be compiled using command

make4ht -ule build.lua filename.tex

The subsequent compilations, when the bibliography and index hadn't changed, can be speed up using

make4ht -ule build.lua -m draft filename.tex

It will execute LaTeX only once, it will not execute Xindy nor Biber.

Here is the result:

enter image description here

0

Try pandoc - https://pandoc.org/

The command line should be something like this:

pandoc -s --toc my.tex -o my.html
  • It says that I haven't got titlepage, but I'm using \begin{titlepage} – Dionisis Stefanopoulos May 22 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.