使用 htlatex 将 LaTeX 转换为 HTML

使用 htlatex 将 LaTeX 转换为 HTML

使用 htlatex 将 LaTeX 转换为 HTML

参考上面提出的问题。

因此,我使用脚本和htlatex命令提示符中的命令将我的 LaTeX 文件转换为 HTML,但两者都出现错误。

命令错误htlatex(无脚本):

*! Package pdftex.def Error: PDF mode expected, but DVI mode detected! (pdftex.def) If you are using latex', then callpdflatex'. (pdftex.def) Otherwise check and correct the driver options. (pdftex.def) Error recovery by switching to PDF mode.
See the pdftex.def package documentation for explanation.*

脚本错误:

--- warning --- Can't find/open file User_Manual.dvi' --- error --- Can't find/open fileUser_Manual.dvi' --- warning --- Can't find/open file `User_Manual.lg'
Could Not Find F:\Documents and Settings\My Documents\User_Manual_new\User_Manual.idv
Could Not Find F:\Documents and Settings\My Documents\User_Manual_new\User_Manual.lg
Could Not Find F:\Documents and Settings\tbinchisti\My Documents\User_Manual\User_Manual.html
Could Not Find F:\Documents and Settings\My Documents\User_Man ual_new\User_Manual.css

我相信这与我拥有的包裹有关,但我不知道是哪些包裹。

这是我的主要.tex文件:

    \documentclass[11pt,a4paper]{report}  
    \usepackage{fancyhdr}  
    \usepackage[pdftex]{color,graphicx}  
    \usepackage{epstopdf}  
    \usepackage{lastpage}  
    \usepackage{makeidx}  
    \usepackage[english]{babel}  
    \usepackage{float}  
    \usepackage{subfig}  
    \usepackage{hyperref}  
    \usepackage{fullpage}  
    \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

\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}



\begin{document}

\input{titlepage} 
\input{DocumentRevisionRecord}
\tableofcontents 
\listoffigures 
\listoftables 
\input{GettingStarted} 
\input{TourtheViews} 
\input{SetuptheWorkspace} 
\input{Map} 
\input{Video}
\input{SectionComposition} 
\input{Segmenting} 
\input{AutomaticMatching} 
\input{Events} 
\input{RoutingEditor} 
\input{DataAnalysis}
\input{CurveFitChapter} 
\input{BatchProcessing} 
\input{TransverseProfile}
\input{PavementModule}
\input{Dashboard} 
\input{TransferAssistant}
\input{DBGenerator} 
\input{DCS} 
\input{WiseCraxImporter} 
\input{RoutingImporter} 
\input{ReportingFramework}


\appendix 
\appendixpage 
\addappheadtotoc 
\input{Roughness} 
\input{CurveFit} 
\input{Faulting} 
\input{ERD} 
\input{Exif} 
\input{LCMSplugin} 
\input{Rut}
\input{PondingDepth} 
\input{Thumbnail}

\printindex

\clearpage 

\end{document}

答案1

尝试按如下方式更改你的序言:

\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}

重要的是命令\@ifpackageloaded{tex4ht}{true part ...}{false part ...}。现在我们可以排除运行时不需要的包htlatex,例如fancyheader设置,我们可以对导致错误的包进行不同的设置。在本例中,graphicx使用pdftex选项,htlatex以 dvi 模式运行,因此我们可以将其设置为dvips

相关内容