5

I am using htxelatex to convert a tex file + config file of my own. I want to change the generated css objects but I can't seem to be able to.

What I am doing

In my config file I use the following

\Css { .cmcsc-10x-x-248{font-size:90\%;} } 

But my generated css keeps the original size

.cmcsc-10x-x-248{font-size:206%;}

Is there a way to edit that class from my config file without using another method (scripting), I want to edit several of them.

Here are some working demos. I just want to make the font smaller.

\documentclass[12pt]{report}


\newenvironment{LOGOAMIGE}{}{~\\[1cm] 
\vspace{2in}}
\newenvironment{navbartext}{}{}
\newcommand{\HRule}{\rule{\linewidth}{0.2mm}}

\begin{document}

\begin{titlepage}
\begin{center}

% Upper part of the page. The '~' is needed because \\
% only works if a paragraph has started.
\begin{LOGOAMIGE}
  THELOGO
\end{LOGOAMIGE}
\begin{navbartext}
    \huge \textsc{Digitarc PX3\texttrademark System}\\[0.1cm]
\end{navbartext}
\begin{navbartext}
    \huge \textsc{Electrode Arc Regulator}
\end{navbartext}


\vfill
\begin{navbartext}
% Bottom of the page
    User Manual\\[0.5cm]
    \Large EAF 1.3
\end{navbartext}
\end{center}
\end{titlepage}

\end{document}

and the config file

\edef\hash{\string#}
\Preamble{xhtml}
  \Configure{@HEAD}{\HCode{<link
         rel="stylesheet" type="text/css"
         href="css/bootstrap.min.css" />\Hnewline}}
  \Configure{@HEAD}{\HCode{<link
         rel="stylesheet" type="text/css"
         href="css/bootstrap-theme.min.css" />\Hnewline}}

\begin{document}
  \ConfigureEnv{titlepage}
    {\HCode {<header class="navbar navbar-bright navbar-fixed-top" role="banner">}} 
    {\HCode {</div></header>}} {} {}
  \ConfigureEnv{LOGOAMIGE}
    {\HCode {
    <div class="navbar-header">
            <button type="button" id="nav-toggle" class="navbar-toggle" data-toggle="collapse" data-target="\#main-nav">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        <a href="\#" class="navbar-brand scroll-top">
    }}
    {\HCode {
      </a>
      </div>
      <div id="main-nav" class="collapse navbar-collapse">
    }}
  \Css { .cmcsc-10x-x-248{font-size:90\%;} } 

\makeatletter
\let\ifes@LaTeXe\iftrue
\makeatother
\Configure{BODY}{\HCode{<body>}}{\HCode{
    <script src="js/jquery-1.11.1.min.js" type="text/javascript"/>
    <script src="js/bootstrap.min.js" type="text/javascript"/>
    <script src="js/amige.js" type="text/javascript"/></body>}
    }
\EndPreamble
  • could you please post a complete example of tex and cfg files? – michal.h21 May 20 '14 at 17:43
  • added example tex and cfg file. – Claudiordgz May 20 '14 at 17:56
3

\Css commands placed in the config file after \begin{document} are ignored. It is sometimes hard to figure out which configurations should be placed before and after \begin{document}. Best is to place it before at first and place it after in the case of problems.

I also little bit modified some other configurations, because non-valid html was produced:

\edef\hash{\string#}
\Preamble{xhtml}
\newcommand\leavepars{\ifvmode\IgnorePar\fi\EndP}
  \Configure{@HEAD}{\HCode{<link
         rel="stylesheet" type="text/css"
         href="css/bootstrap.min.css" />\Hnewline}}
  \Configure{@HEAD}{\HCode{<link
         rel="stylesheet" type="text/css"
         href="css/bootstrap-theme.min.css" />\Hnewline}}
  \Css { .cmcsc-10x-x-248{font-size:90\%;} } 
\Configure{TITLE+}{Digitarc PX3\texttrademark System}
\begin{document}
  \ConfigureEnv{titlepage}
    {\leavepars\HCode {<header class="navbar navbar-bright navbar-fixed-top" role="banner">}} 
    {\leavepars\HCode {</div></header>}} {} {}
  \ConfigureEnv{LOGOAMIGE}
    {\leavepars\HCode {
    <div class="navbar-header">
            <button type="button" id="nav-toggle" class="navbar-toggle" data-toggle="collapse" data-target="\#main-nav">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        <a href="\#" class="navbar-brand scroll-top">
    }}
    {\leavepars\HCode {
      </a>
      </div>
      <div id="main-nav" class="collapse navbar-collapse">
    }}

\makeatletter
%\let\ifes@LaTeXe\iftrue
\makeatother
\Configure{BODY}{\HCode{<body>}}{\HCode{
    <script src="js/jquery-1.11.1.min.js" type="text/javascript"></script>\Hnewline
    <script src="js/bootstrap.min.js" type="text/javascript"></script>\Hnewline
    <script src="js/amige.js" type="text/javascript"></script>\Hnewline</body>}
    }
\EndPreamble

I've created leavepars command and placed it before \HCode commands which produced <div> elements. This will prevent tags crossing, such as <div></p>, which happened with the former definition. I've also added \Configure{TITLE+} configuration, because title element is empty otherwise, when you don't use \title command in your document. At last, I've commented out %\let\ifes@LaTeXe\iftrue which produced LaTeXe before <title>, so it obviously haven't worked anyway.

  • 1
    You are awesome, I've learned so much with your answers and questions here in stackexchange. – Claudiordgz May 20 '14 at 22:07
  • 1
    @Claudiordgz thank you. I am happy when my answers are helpful :) – michal.h21 May 21 '14 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.