使用 TeX4ht 建立自己的樣式

使用 TeX4ht 建立自己的樣式

我已經在下面給出了我的標籤:

\documentclass{book}
\newcommand{\HalfTitle}[1]{\large#1}
\begin{document}
\HalfTitle{Half Title}
\end{document}

我需要在 HTML 輸出中將其作為:

<HalfTitle> Half Title </HalfTitle>

我怎樣才能實現這個目標?我使用以下標籤進行 HTML 轉換:

htlatex test "xhtml" " -cunihft" "-cvalidate -p"

請建議...

答案1

--- 檔案.tex

\documentclass{article}
\usepackage{mytag}
\begin{document}
\mytag{Test 123}
\end{document}

--- 自訂.cfg

\Preamble{xhtml}
\NoFonts
\Configure{mytag}{\HCode{<mytag>}}{\HCode{</mytag>}}
\begin{document}
\EndPreamble

--- mytag.sty

\ProvidesPackage{mytag} 
\newcommand\mytag[1]{\textbf{#1}}
\endinput

--- mytag.4ht

\NewConfigure{mytag}{2}
\let\tmp:mytag\mytag
\renewcommand\mytag[1]{\a:mytag\tmp:mytag#1\b:mytag} 

跑步:

htlatex file.tex "custom,charset=utf-8" " -cunihft"

相關內容