未定义控制序列 \titlefont

未定义控制序列 \titlefont

我想用 tex4ebook texlive 编译我的文档。但它发现了几个错误,其中第一个是“!未定义的控制序列。\cw:TITLE+ ->\titlefont Title 1.104 \begin{document}”

在我的文档中我有以下几行:

\font\titlefont=cmr12 at 40pt
\title {\titlefont Title}

它可以很好地编译为 pdf 格式。我该如何修复 tex4ebook 的错误?

我的文档(经过少许编辑(名称、标题等))

\documentclass[12pt, twodise]{book}
\usepackage[polish, russian, english]{babel}
\usepackage[babel,autostyle=true]{csquotes}
\MakeOuterQuote{"}
\selectlanguage{english}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage{indentfirst}
\usepackage{needspace}
\usepackage{comment}
\usepackage[inner=0.75in, outer=0.75in, top=0.75in, bottom=0.75in, paperwidth=6in, paperheight=9in]{geometry}% inner=0.875in
%\usepackage{changepage}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{anyfontsize}
\usepackage{xargs}
\usepackage{epigraph}
\usepackage{afterpage}
\usepackage[figuresright]{rotating}
\usepackage{lettrine}
\usepackage{yfonts}
\usepackage{dpfloat}
\usepackage{nopageno}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[font=Large,labelfont=Large]{caption}
\graphicspath{{"graphics/"}}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\setlength{\parskip}{1em}

\newcommandx{\spic}[3][1=0,2]{
    \clearpage
    \noindent\begin{minipage}[t][\dimexpr\textheight-6pt\relax][c]{\textwidth}
    \centering\includegraphics[angle=#1, width=\textwidth]{#3}
    %\caption*{#2}
    \end{minipage}
    \clearpage
}
\newcommandx{\pic}[3][1=0,2]{
    \begingroup
    \clearpage
    \newpage
    \vspace*{3in}  
    \centering{\Large #2}
    \newpage
    \begin{minipage}[t][\dimexpr\textheight-6pt\relax][c]{\textwidth}
    \center{\includegraphics[angle=#1, width=\textwidth]{#3}}
    %\caption*{#2}
    \end{minipage}
    \clearpage
    \endgroup
}
\newcommandx{\lpic}[3][1=0, 2=]{
    \newpage
%   \clearpage
%   \thispagestyle{empty}
    \begin{sidewaysfigure}[ht]
    \center{\includegraphics[angle=#1, width=0.8\textheight]{#3}}
    \caption*{#2}
    \end{sidewaysfigure}
}
\newcommand\blankpage{
    \null
    %\thispagestyle{empty}
    %\addtocounter{page}{-1}
    \newpage
}
\newcommand{\tmpx}{}
\newcommand\tmp[1]{\renewcommand{\tmpx}{#1}}
\fancypagestyle{capt}{\fancyfoot[R]{\tmpx}}
\newcommandx{\twosidepic}[2][2]{
    \clearpage
    \begingroup
    \sbox0{\includegraphics{#1}}
    %\tmp{#2}\thispagestyle{capt}
    \begin{figure}[p]% will be the left-side figure
    \begin{leftfullpage}
    \noindent\begin{minipage}[t][\textheight][c]{\paperwidth}
    \hspace*{-2\leftmargin}
    \includegraphics[trim=0 0 {.5\wd0} 0,width=\dimexpr\paperwidth\relax,clip]{#1}
    \captionsetup{font = Large, labelfont=Large, singlelinecheck = false, format= hang, justification=raggedleft, labelsep=space}
    \caption*{}
    \end{minipage}
    \end{leftfullpage}
    \end{figure}
    \begin{figure}[p]
    \begin{fullpage}
    \noindent\begin{minipage}[t][\textheight][c]{\paperwidth}
    \hspace*{-2\leftmargin}
    \includegraphics[trim={.5\wd0} 0 0 0,width=\dimexpr\paperwidth\relax,clip]{#1}
    \captionsetup{font = Large, labelfont=Large, singlelinecheck = false, format= hang, labelsep=space, justification=centering} %justification=justified
    \caption*{#2}
    \end{minipage}
    \end{fullpage}
    \end{figure}
    \endgroup
}
% \pagestyle{fancy}
 \fancyhf{}
 \fancypagestyle{alim}{\fancyhf{}\renewcommand{\headrulewidth}{0pt}\fancyfoot[C]{\arabic{page}}}

\addto\captionsenglish{\renewcommand{\figurename}{}}

\begin{document}

%\def\pageformatTexOdd{}
\font\titlefont=cmr12 at 40pt
\font\authorfont=cmr12 at 24pt
%\fontsize{20}{20pt}\selectfont
\date{}
\title {\titlefont .........}
\author {\authorfont .........}
\maketitle
\blankpage
\epigraph {``............''} {\textit{.........}}
\blankpage
\pic{_SDC2222}
\twosidepic{_SDC3333}
\spic{_SDC4444}
\spic{_SDC5555}

\blankpage
\chapter*{sec1}
\addcontentsline{toc}{section}{sec1}
\thispagestyle{alim}
asdfgafsdgasdfvasdfvadf

\textbf{dsfsdfsd.}
\textit{DSFasdfsdfasdfgsdfgsdfgsdgfsdfgsdfgdsfgs.}\\
dfgadfgadfgadfgadfgadfgadfgadfg


%\end{comment}
\end{document}

答案1

\title您可以使用 来消除命令中引起问题的宏\Configure{@TITLE}。问题是它的内容<title>在 HTML 标头中的元素中被重复使用,而该元素不应包含任何子元素。

将以下代码保存为myconfig.cfg

\Preamble{xhtml}
\Configure{@TITLE}{\let\titlefont\relax}
\begin{document}
\EndPreamble

使用以下方式编译文件

tex4ebook -c myconfig.cfg filename.tex

结果如下:

在此处输入图片描述

相关内容