tex4ebook:\author 没有设置 epub dc:creator

tex4ebook:\author 没有设置 epub dc:creator

注意到使用时,tex4ebook -f epub3kindle 预览器显示生成的 epub 为匿名。果然,它的 content.opf 有

<dc:creator>Anonymous</dc:creator>

这是在 Windows 上运行 TeXlive 2023(已更新)生成的

tex4ebook -f epub3 mwe_no_creator.tex

看起来mwe_no_creator.tex

\documentclass{memoir}

\usepackage{lipsum}

\title{A Cool Anthology}
\author{S.~Guide}
\date{}  % suppress normally-inserted date

\begin{document}

\maketitle
\thispagestyle{empty}  % suppress page number on title page (!)

\frontmatter

\tableofcontents

\mainmatter

\chapter{Story A}{

Story A graf 1

Story A graf 2

\lipsum

\end{document}

在此文件上使用 pdflatex 会生成一个显示标题和作者的标题页。

看起来这似乎是一件很简单的事情,但我看不出我在这里做错了什么。欢迎提出建议。

顺便说一句,这是在没有 html tidy 的情况下运行的,因为我发现它似乎会引入很多 epubcheck 问题(如果没有 tidy,则生成的 epub 根据 epubcheck 是干净的)。

答案1

此问题似乎已在 的开发版本中修复tex4ebook。在我将更新版本发布到 CTAN 之前,您可以使用 的修复版本tex4ebook.sty

% Package tex4ebook. Author Michal Hoftich <[email protected]>
% This package is subject of LPPL license, version 1.3 
\ProvidesPackage{tex4ebook}[{{date}} version {{version}}]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
% Command for generating NCX file. The hard work is done in the file
% tex4ebook.4ht
\def\ncxtable{}
% Command for generating OPF file 
\def\opftable{}

%Declare RFC3066 language code for babel language name
\def\DeclareLanguageEbook#1#2{%
\csgdef{rfclang#1}{#2}%
}
\def\GetLanguage{%
\ifx\bbl@main@language\@undefined en-US%  
\else%
\ifcsdef{rfclang\bbl@main@language}{\csuse{rfclang\bbl@main@language}}{}%
\fi%
}

\DeclareLanguageEbook{UKenglish}{en-GB}
\DeclareLanguageEbook{USenglish}{en-US}
\DeclareLanguageEbook{acadian}{fr}
\DeclareLanguageEbook{albanian}{sq}
\DeclareLanguageEbook{american}{en-US}
\DeclareLanguageEbook{amharic}{am}
\DeclareLanguageEbook{arabic}{ar}
\DeclareLanguageEbook{armenian}{hy}
\DeclareLanguageEbook{australian}{en-US}
\DeclareLanguageEbook{austrian}{de}
\DeclareLanguageEbook{basque}{eu}
\DeclareLanguageEbook{bengali}{bn}
\DeclareLanguageEbook{brazilian}{pt}
\DeclareLanguageEbook{brazil}{pt}
\DeclareLanguageEbook{breton}{br}
\DeclareLanguageEbook{british}{en-GB}
\DeclareLanguageEbook{bulgarian}{bg}
\DeclareLanguageEbook{canadian}{en-US}
\DeclareLanguageEbook{canadien}{fr}
\DeclareLanguageEbook{catalan}{ca}
\DeclareLanguageEbook{croatian}{hr}
\DeclareLanguageEbook{czech}{cs-CZ}
\DeclareLanguageEbook{danish}{da}
\DeclareLanguageEbook{divehi}{dv}
\DeclareLanguageEbook{dutch}{nl}
\DeclareLanguageEbook{english}{en}
\DeclareLanguageEbook{esperanto}{eo}
\DeclareLanguageEbook{estonian}{et}
\DeclareLanguageEbook{finnish}{f\/i}
\DeclareLanguageEbook{francais}{fr}
\DeclareLanguageEbook{french}{fr}
\DeclareLanguageEbook{galician}{gl}
\DeclareLanguageEbook{germanb}{de}
\DeclareLanguageEbook{german}{de}
\DeclareLanguageEbook{greek}{el}
\DeclareLanguageEbook{hebrew}{he}
\DeclareLanguageEbook{hindi}{hi}
\DeclareLanguageEbook{hungarian}{hu}
\DeclareLanguageEbook{icelandic}{is}
\DeclareLanguageEbook{interlingua}{ia}
\DeclareLanguageEbook{irish}{ga}
\DeclareLanguageEbook{italian}{it}
\DeclareLanguageEbook{kannada}{kn}
\DeclareLanguageEbook{khmer}{km}
\DeclareLanguageEbook{korean}{ko}
\DeclareLanguageEbook{lao}{lo}
\DeclareLanguageEbook{latin}{la}
\DeclareLanguageEbook{latvian}{lv}
\DeclareLanguageEbook{lithuanian}{lt}
\DeclareLanguageEbook{lowersorbian}{dsb}
\DeclareLanguageEbook{magyar}{hu}
\DeclareLanguageEbook{malayalam}{ml}
\DeclareLanguageEbook{marathi}{mr}
\DeclareLanguageEbook{naustrian}{de}
\DeclareLanguageEbook{newzealand}{en}
\DeclareLanguageEbook{ngerman}{de}
\DeclareLanguageEbook{norsk}{no}
\DeclareLanguageEbook{norwegiannynorsk}{nn}
\DeclareLanguageEbook{nynorsk}{no}
\DeclareLanguageEbook{occitan}{oc}
\DeclareLanguageEbook{oldchurchslavonic}{cu}
\DeclareLanguageEbook{persian}{fa}
\DeclareLanguageEbook{polish}{pl-PL}
\DeclareLanguageEbook{polutonikogreek}{el}
\DeclareLanguageEbook{portuges}{pt}
\DeclareLanguageEbook{portuguese}{pt}
\DeclareLanguageEbook{romanian}{ro}
\DeclareLanguageEbook{romansh}{rm}
\DeclareLanguageEbook{russian}{ru}
\DeclareLanguageEbook{samin}{se}
\DeclareLanguageEbook{sanskrit}{sa}
\DeclareLanguageEbook{scottish}{gd}
\DeclareLanguageEbook{serbian}{sr}
\DeclareLanguageEbook{serbo-croatian}{sh}
\DeclareLanguageEbook{slovak}{sk}
\DeclareLanguageEbook{slovene}{sl}
\DeclareLanguageEbook{slovenian}{sl}
\DeclareLanguageEbook{spanish}{es}
\DeclareLanguageEbook{swedish}{sv}
\DeclareLanguageEbook{tamil}{ta}
\DeclareLanguageEbook{telugu}{te}
\DeclareLanguageEbook{thai}{th}
\DeclareLanguageEbook{tibetan}{bo}
\DeclareLanguageEbook{turkish}{tr}
\DeclareLanguageEbook{turkmen}{tk}
\DeclareLanguageEbook{ukrainian}{uk}
\DeclareLanguageEbook{uppersorbian}{hsb}
\DeclareLanguageEbook{urdu}{ur}
\DeclareLanguageEbook{vietnamese}{vi}
\DeclareLanguageEbook{welsh}{cy}

\AtEndDocument{%
\ncxtable
\opftable
}

% Default empty values
\def\Title{Unnamed}
\def\Author{Anonymous}

% We need to save values of title, author etc.
\let\tf@orig@title\title

% normal \title
\newcommand\tf@title[1]{%
  \tf@orig@title{#1}%
  \let\Title\@title%
}

% \title with optional argument
\newcommand\tf@opttitle[2][]{%
  \tf@orig@title[#1]{#2}%
  \let\Title\@title%
}

% some classes (amsart) define \title command with optional argument
\renewcommand\title{%
\@ifnextchar[\tf@opttitle\tf@title%
}

\let\tf@orig@author\author
\newcommand\tf@author[1]{%
  \tf@orig@author{#1}%
  \gdef\Author{#1}%
}

\newcommand\tf@optauthor[2][]{%
  \tf@orig@author[#1]{#2}%
  \gdef\Author{#2}%
}

% support optiona argument for \author as well
\renewcommand\author{%
\@ifnextchar[\tf@optauthor\tf@author%
}

%\let\Author\@author
\let\Date\today
\let\origdate\date
\renewcommand\date[1]{%
  \origdate{#1}%
  \global\let\Date\@date%
}
%}


% Fixes for AMS classess
\AddToHook{class/after}{%
  \ifx\authors\@empty%
  \def\@maketitle@hook{
  \global\let\Author\authors
  }
  \fi%
}

\newcommand\coverimage[2][]{\includegraphics[#1]{#2}}

\newcommand\epubpage{\clearpage}

\endinput

它生成以下元数据文件:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.idpf.org/2007/opf"
unique-identifier="dcidid" version="3.0">
  <metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:opf="http://www.idpf.org/2007/opf">
    <dc:title>A Cool Anthology</dc:title>
    <dc:language>en-US</dc:language>
    <dc:identifier id="dcidid">
    http://example.com/sample</dc:identifier>
    <dc:creator>S.&#160;Guide</dc:creator>
    <dc:date>2023-11-12T16:25:00Z</dc:date>
    <meta property="dcterms:modified">2023-11-12T16:25:00Z</meta>
  </metadata>
  <manifest>
    <item id="ncx" href="sample.ncx"
    media-type="application/x-dtbncx+xml" />
    <item id="stylesheet" href="sample.css"
    media-type="text/css" />
    <item id="file1" href="sample.xhtml"
    media-type="application/xhtml+xml" />
    <item id="file2" properties="nav" href="sampleli1.xhtml"
    media-type="application/xhtml+xml" />
    <item id="file3" href="samplech1.xhtml"
    media-type="application/xhtml+xml" />
  </manifest>
  <spine toc="ncx">
    <itemref idref="file1" />
    <itemref idref="file2" />
    <itemref idref="file3" />
  </spine>
</package>

相关内容