.cfg ファイルからではなく .cls ファイルから .css を生成する

.cfg ファイルからではなく .cls ファイルから .css を生成する

構成ファイル (つまり \Css {}) ではなく、カスタマイズされた .cls ファイルに基づいて .css ファイルを生成することは可能ですか。たとえば、環境引用符はクラス ファイルで次のように定義されています。

\newenvironment{quote}%
               {\list{}{\topsep9\p@\leftmargin\z@\rightmargin\z@}%
                \small\fontseries{b}\selectfont%
                \item\relax\}%
               {\endlist}%

HTML 変換のコマンドを使用しておりhtlatex test "xhtml,fn-in" "-cunihft" "-cvalidate -p"、変換された HTML 出力は次のようになります。

                    <p class="indent" >
                    <span 
class="ptmr8t-x-x-90">Collusion  is  when  firms  use  history-dependent  strategies  to  sustain</span></p>

CSS 出力は次のようになります。

.quote {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; margin-right:1em; text-align:justify;}

つまり、CSS 出力は実際にはクラス (.cls) ファイルから生成されるのではなく、構成ファイル (tex4ht に使用される .cfg) から生成されます。

CSS での期待される出力 (「引用」の場合) は次のようになります。

.quote {font-size:80%; font-weight: bold;}

これを実現するにはどうすればいいでしょうか? ご提案をお願いします...

答え1

.4htクラス用のファイルを作成できます。たとえば、クラスがあるとしますmyclass.cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2017/07/11 Example LaTeX class]
\LoadClass[]{article}
\renewenvironment{quote}%
               {\list{}{\topsep9\p@\leftmargin\z@\rightmargin\z@}%
                \small\fontseries{b}\selectfont%
                \item\relax}%
               {\endlist}% 

\endinput

設定.4htファイルは次のようになりますmyclass.4ht:

\ConfigureEnv{quote}{\NoFonts}{\EndNoFonts}{}{}
\Css{.quote{font-size:80\%; font-weight: bold;}}

\endinput

環境の設定はquote、これらの要素を取り除くために、環境内のフォントヒューリスティックを無効にするだけです<span class="ptmr8t-x-x-90">。 のデフォルト設定では、環境の周囲に自動的に追加されるquoteため、手動で追加する必要はありません。コマンドでは、を使用して文字をエスケープする必要があります。tex4ht<div class="quote">\Css%\%

次のサンプル ファイル:

\documentclass{myclass}

\begin{document}
\section{Do common commands work?}

Yes, \textbf{they} \textit{do}\footnote{even footnotes?}.
\begin{quote}
  Collusion  is  when  firms  use  history-dependent  strategies  to  sustain
\end{quote}
\end{document}

この結果が生成されます:

ここに画像の説明を入力してください

<div class="quote">
<!--l. 8--><p class="noindent" >Collusion is when firms use history-dependent strategies to sustain</p></div>

答え2

私が尋ねた要件に似たアンドリューの返信を見ました。リンクはtex4htのCFGファイル内の\Configureコーディングを簡素化できますか?試していただいた皆様ありがとうございました...

関連情報