Try to change your preamble this way:
\documentclass[11pt,a4paper]{report}
\usepackage{fancyhdr}
\makeatletter
\@ifpackageloaded{tex4ht}{%
\usepackage[dvips]{color,graphicx}
\usepackage[tex4ht]{hyperref}
}{%
\usepackage[pdftex]{color,graphicx}
\usepackage{hyperref}
\setlength{\headwidth}{\textwidth}
\fancyhead[L]{\rightmark}
\fancyhead[R]{\includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo \fancyfoot{}%to remove centered default footer
\fancyfoot[L]{Fugro Roadware Inc.}
\fancyfoot[R]{\thepage \ of \pageref*{LastPage}}% page# of reference page(last)
\fancypagestyle{plain}% no header, footer contains page number centered {
\fancyhf{} %for the pages outside of content, list of figures etc.
\fancyhead[R]{ \includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo
\fancyfoot[L]{Fugro Roadware Inc.} \fancyfoot[R]{\thepage \ of \pageref*{LastPage}}
\pagestyle{fancy}
\usepackage[absolute]{textpos}
\usepackage{fullpage}
}
\makeatother
\usepackage{epstopdf}
\usepackage{lastpage}
\usepackage{makeidx}
\usepackage[english]{babel}
\usepackage{float}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{appendix}
\usepackage{verbatim}
\renewcommand{\appendixtocname}{Appendix: Algorithm Parameters} \renewcommand{\appendixpagename}{Appendix-Algorithm Parameters}
\setlength{\topmargin}{-1.3cm} \setlength{\headsep}{0.6cm}
\renewcommand{\tablename}{\bfseries{Table}}
%The top margin above a chapter can be changed using the titlesec package
\hypersetup{
bookmarks=true, % show bookmarks bar?
unicode=false, % non-Latin characters in Acrobat’s bookmarks
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={My title}, % title
pdfauthor={Author}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Creator}, % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keyword1} {key2} {key3}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links }
}
\input{Macro} %\renewcommand{\caption}[1]{{\underline{#1}}}
\makeindex
\renewcommand{\headheight}{0.6in} %Space above header \renewcommand{\headrulewidth}{1pt} %thickness of line under header \renewcommand{\footrulewidth}{1pt} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} %thickness of line on title page
\begin{document}
bhg fgfgf hgh ghghgf fdfd
\end{document}
important is the command \@ifpackageloaded{tex4ht}{true part ...}{false part ...}
. Now we can exclude packages which aren't needed when htlatex
is run, such as fancyheader
settings, and we can have different settings for packages which causes errors. In this case graphicx
with pdftex
option, htlatex
is running in dvi mode, so we can set it to dvips
ConTeXt does not directly output XHTML, it outputs XML. However the current browsers (at least Opera, Firefox and Chromium) are able to display XML correctly. The XML can be styled using CSS.
When you want real XHTML, you have to transform the XML to XHTML using external tools. ConTeXt standalone ships with an example file: texmf-context/tex/context/base/export-example.{tex,css}
. Here is a modified and shortened version of this file for demonstration.
% file example.tex
\setupexport [width=470pt, hyphen=yes]
\setupbackend [export=example.xml, css=example.css]
\setupbodyfont [dejavu]
\setupinteraction [state=start]
\setuplayout [width=middle]
\setupwhitespace [big]
\definedescription [description] [width=broad, alternative=hanging]
\definemathalignment [gather] [n=1,align={middle}]
\starttext
\startchapter [title=Example]
\startparagraph
\input ward
\stopparagraph
\startparagraph
You'll find more information on the ConTeXt garden.
\startfootnote
The ConTeXt garden is the ConTeXt wiki.
\stopfootnote
Another option is to contact the mailing list.
\stopparagraph
\startplacefigure [title=Some cows]
\startcombination[3*1]
{\externalfigure[cow.png][width=3cm]} {medium}
{\externalfigure[cow.png][width=4cm]} {large}
{\externalfigure[cow.png][width=2cm]} {small}
\stopcombination
\stopplacefigure
\startdescription {Ward}
\input ward
\stopdescription
\startformula
x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\stopformula
\starttabulate [|l|r|p|]
\NC And \NC here \NC comes \NC \NR
\NC a \NC table \NC \input ward \NC \NR
\stoptabulate
\stopchapter
\stoptext
And here comes the corresponding CSS file, that is responsible for the styling in the browser.
/* file example.css */
document {
font-family : "DejaVu Serif", serif ;
font-size : 12pt ;
line-height : 18pt ;
max-width : 50em ;
padding : 1em ;
}
paragraph, p {
display : block ;
margin-top : 0.5em ;
margin-bottom : 0.5em ;
}
section {
display : block ;
}
sectioncontent {
display : block ;
margin-top : 1em ;
margin-bottom : 1em ;
}
section[detail="chapter"], section[detail="title"] {
margin-top : 3em ;
margin-bottom : 2em ;
}
section[detail="chapter"]>sectionnumber {
display : inline-block ;
margin-right : 1em ;
font-size : 3em ;
font-weight : bold ;
}
section[detail="chapter"]>sectiontitle, section[detail="title"]>sectiontitle {
font-size : 3em ;
font-weight : bold ;
}
description {
display : block ;
margin-bottom : 1em ;
margin-top : 1em ;
}
descriptiontag {
float : left ;
clear : left ;
margin-right : 1em ;
text-align : left ;
font-weight : bold ;
}
tabulate {
display : table ;
margin-top : 1em ;
margin-bottom : 1em ;
margin-left : 2.5em ;
}
tabulaterow {
display : table-row ;
}
tabulatecell[align="middle"] {
display : table-cell ;
text-align : center ;
padding-right : 1em ;
}
tabulatecell[align="flushleft"] {
display : table-cell ;
text-align : left ;
padding-right : 1em ;
}
tabulatecell[align="flushright"] {
display : table-cell ;
text-align : right ;
padding-right : 1em ;
}
tabulatecell {
display : table-cell ;
text-align : left ;
padding-right : 1em ;
}
combination {
display : table ;
margin-top : 0em ;
margin-bottom : 0em ;
}
combinationpair {
display : table-cell ;
padding-right : 1em ;
}
combinationcontent {
display : table-row ;
text-align : center ;
}
combinationcaption {
display : table-row ;
padding-top : 1ex ;
text-align : center ;
}
float {
display : block ;
text-align : center ;
margin-top : 1em ;
margin-bottom : 1em ;
margin-left : 2.5em ;
}
floatcaption {
display : block ;
margin-top : 0.5em ;
color : rgb(60%,60%,0%) ;
}
floatlabel {
font-weight : bold ;
margin-right : 1em ;
}
floatnumber {
font-weight : bold ;
}
formula {
display : block ;
margin-top : 1em ;
margin-bottom : 1em ;
margin-left : 2.5em ;
}
sup {
font-size : xx-small ;
line-height : 0 ;
vertical-align : top ;
}
Here is a screenshot from the PDF version:
And this is a screenshot from the browser:
As you can see, the style is pretty close. It can be further optimized through tweaking the CSS file. Included graphics, of course, have to be present in a format that the browser can handle.
Hyphenation is also present. ConTeXt inserts soft hyphen (0x00AD
) characters where hyphenation is possible, which enables the browser to justify the paragraphs.
The resulting XML can be displayed by browsers and e-book readers. However, not all e-book reader are compatible, especially when it comes to math. Browsers also have their problems with displaying math.
Best Answer
Pandoc's LaTeX parser is limited; it will generally get you most of the way there, but some manual cleanup is usually required. Note also that pandoc currently interprets LaTeX macros only in math contexts, and your document makes heavy use of macros.