2

I am trying to reconfigure the \title{}, \author{}, \affiliation{} in tex4ht.

I am unable to reconfigure, i am facing the below issue.

  1. need to re-configure title as
  2. need to configure subtitle as , but currently printing without

    tag

  3. need to configure author as
  4. each affiliation should be each in

I am using make4ht.exe

how to get the following expected output

<div class="maketitle">
    <p class="titleHead">Article Title with bold and Itlaic formating with Inline formula and with footnote</p>
    <p class="subtitle">Chapter Subtitle with bold and formating and a + b = c</p>
    <div class="author" >Xiaotuo Qiao<sup>1,2</sup><orcid>https://orcid.org/000-000-0000</orcid>,&#x00A0;Haifeng Guo<sup class="textsuperscript">1,3</sup><orcid>https://orcid.org/000-000-0001"</orcid>,&#x00A0;and Jun Li<sup class="textsuperscript">3</sup><orcid>https://orcid.org/000-000-0001"</orcid></div>
    <p class="affil"><sup>1</sup>Department of Chemistry, University of Munich (LMU), 81377 Munich, Germany</p>
    <p class="affil"><sup>2</sup>Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany</p>
    <p class="affil"><sup>3</sup>Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany</p>
</div>
   

MWE

\documentclass{article}
\usepackage{color,hyperref}

\makeatletter
\newcount\tempcount
\newcount\tempauthorcount
\newcount\authorcount
\newcount\authorcommacount
\newcount\authortempcount
\newcount\tempaffilcount
\newcount\affiliationcount

\def\afid#1{#1}
\def\afn#1{#1}
\def\crsp#1{#1}
\def\abio#1{#1}

\def\subtitle#1{\gdef\@subtitle{#1}}\subtitle{}
\def\supertitle#1{\gdef\@supertitle{#1}}\supertitle{}
\def\author{\@ifnextchar[{\@@AUTHOR}{\@@AUTHOR[]}}

\def\@@AUTHOR[#1]#2#3{%
              \gdef\au@data{yes}%
              \gdef\@thirdarg{#3}%
              \gdef\@secondarg{#2}%
%              \setbox\@tempboxa\hbox{\def\AQ{}#2}%
              \expandafter\protected@xdef\csname author\the\authorcount\endcsname{{#2\textsuperscript{#1}%
                        \ifx\@thirdarg\@empty\else\protect\href{https://orcid.org/#3}{\textcolor{green}{{\fontsize{7}{7}\selectfont\textcircled{{\fontsize{4}{4}\selectfont id}}}}}\fi
                        }}%
              \global\advance\authorcount1%
              }%

\gdef\@author{%
              \global\tempauthorcount\authorcount%
              \global\advance\tempauthorcount-1%
              \global\authorcommacount\tempauthorcount%
              \global\advance\authorcommacount-1%
              \global\authortempcount0%
              \global\authortempcount0%
              \ifnum\authorcount=1%
                \ignorespaces\csname author0\endcsname\unskip\unskip\unskip%
              \else%
                \ifnum\authorcount=2%
                    \ignorespaces\csname author0\endcsname and \csname author1\endcsname\unskip\unskip\unskip%
                \else%
                   \@whilenum\tempcount<\tempauthorcount
                     \do{%
                         \csname author\the\tempcount\endcsname,\ %
                         \global\advance\tempcount1%
                        }%
                         and \csname author\the\tempcount\endcsname\unskip\unskip\unskip\unskip%
                \fi%
              \fi%
             }%
%
\def\affiliation{\@ifnextchar[{\@@affiliation}{\@@affiliation[]}}


\def\@@affiliation[#1]#2{\gdef\@affoptarg{#1}%
                   \gdef\au@data{no}%
                   \global\advance\affiliationcount1%
                    \expandafter\gdef\csname affiliation\the\affiliationcount\endcsname{\textsuperscript{#1}#2}%
                }


\def\printaffiliation{\itshape\parindent=0pt\def\baselinestretch{1}%
           \global\tempcount0%
           \global\tempaffilcount\affiliationcount
           \global\advance\tempaffilcount-1
               \@whilenum\tempcount<\tempaffilcount
                                \do{%
                     %\refstepcounter{afrfilnote}%
                      {\noindent\csname affiliation\the\tempcount\endcsname\unskip\ignorespaces\unskip\unskip\unskip\unskip\unskip\unskip\@@par}%
                     \global\advance\tempcount1}%
                     %\refstepcounter{afrfilnote}%
                      {\noindent\csname affiliation\the\tempcount\endcsname\unskip\unskip\unskip\unskip\unskip\unskip\@@par}%
        \global\authorcount0
        \global\tempauthorcount0
}

\def\corsnotes{}

\def\corresnotes{\@ifnextchar[{\@@CORRS}{\@@CORRS[]}}

\newcount\crspcnt
\newcount\auncnt
\newcount\biocnt


\def\@@CORRS[#1]#2{\advance\crspcnt by 1\g@addto@macro\corsnotes{\ifnum\the\crspcnt>1\vspace*{3pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\AUnotes{}

\def\aunotes{\@ifnextchar[{\@@AUNOTES}{\@@AUNOTES[]}}

\def\@@AUNOTES[#1]#2#3{\advance\auncnt by 1\g@addto@macro\AUnotes{\ifnum\the\auncnt>1\else\vspace*{6pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\AUBIO{}

\def\bio{\@ifnextchar[{\@@BIO}{\@@BIO[]}}

\def\@@BIO[#1]#2{\advance\biocnt by 1\g@addto@macro\AUBIO{\ifnum\the\biocnt>1\else\vspace*{6pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \let \footnote \thanks
  \noindent{\large \@supertitle \par}\vspace*{12pt}
    \noindent{\LARGE \@title \par}
    \ifx\@substitle\@empty
    \else
    \vspace*{12pt}%
    \noindent{\large \@subtitle \par}%
    \fi 
    \vskip 1.5em%
    {%
        \noindent\@author\endgraf%
        \vspace*{6pt}
        {\noindent\printaffiliation\par}%
        \if!\corsnotes!
        \else
        \vspace*{6pt}%
        %\begin{mybox}[colback=white]{Correspondence details}
            {\small\corsnotes\endgraf}%
        %\end{mybox}
        \fi%
        \if!\AUnotes!
        \else
                \vspace*{6pt}%
        %\begin{mybox}[colback=white]{Author Notes}
            {\small\AUnotes\endgraf}
         %\end{mybox}
        \fi
        \if!\AUBIO!%
        \else%
            \vspace*{6pt}%
        \begin{mybox}[colback=white]{Author Bio}
            {\small\AUBIO\endgraf}%
       \end{mybox}
        \fi%
        }%
  \par
  
    \vskip 36pt
  }

\makeatother

\begin{document}


\title{Article Title with \textbf{bold} and \textit{Itlaic formating} with Inline formula and with footnote}

\subtitle{Chapter Subtitle with \textbf{bold} and \textit{formating} and  $a+b=c$}

\author[1,2]{Xiaotuo Qiao}{000-000-0000}
\author[1,3]{Haifeng Guo}{000-000-0001}
\author[3]{Jun Li}{000-000-0002}


\affiliation[1]{Department of Chemistry, University of Munich (LMU), 81377 Munich, Germany}

\affiliation[2]{Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany}

\affiliation[3]{Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany}


\maketitle

with various subtle distinctions among them. Even the existence theory for modes is not entirely straightforward: there are already examples in the literature, and this article will supply further examples, of relatively simple probability measures that have no mode. It can even be the case that the average of two disjointly supported unimodal probability measures may have no mode.


\end{document}

1 Answer 1

2

I would move your custom commands to a standalone package, mytitle.sty:

\ProvidesPackage{mytitle}
\newcount\tempcount
\newcount\tempauthorcount
\newcount\authorcount
\newcount\authorcommacount
\newcount\authortempcount
\newcount\tempaffilcount
\newcount\affiliationcount

\def\afid#1{#1}
\def\afn#1{#1}
\def\crsp#1{#1}
\def\abio#1{#1}

\def\subtitle#1{\gdef\@subtitle{#1}}\subtitle{}

\def\printsubtitle{%
  \vspace*{12pt}%
  \noindent{\large \@subtitle \par}%
}

\def\supertitle#1{\gdef\@supertitle{#1}}\supertitle{}
\def\author{\@ifnextchar[{\@@AUTHOR}{\@@AUTHOR[]}}

\def\orcidlogo{\textcolor{green}{{\fontsize{7}{7}\selectfont\textcircled{{\fontsize{4}{4}\selectfont id}}}}}

\def\printorcid#1{\href{https://orcid.org/#1}{\orcidlogo}}

\def\@@AUTHOR[#1]#2#3{%
  \gdef\au@data{yes}%
  \gdef\@thirdarg{#3}%
  \gdef\@secondarg{#2}%
  %              \setbox\@tempboxa\hbox{\def\AQ{}#2}%
  \expandafter\protected@xdef\csname author\the\authorcount\endcsname{{#2\textsuperscript{#1}%
      \ifx\@thirdarg\@empty\else\protect\printorcid{#3}\fi
  }}%
  \global\advance\authorcount1%
}%

\gdef\@author{%
  \global\tempauthorcount\authorcount%
  \global\advance\tempauthorcount-1%
  \global\authorcommacount\tempauthorcount%
  \global\advance\authorcommacount-1%
  \global\authortempcount0%
  \global\authortempcount0%
  \ifnum\authorcount=1%
    \ignorespaces\csname author0\endcsname\unskip\unskip\unskip%
  \else%
    \ifnum\authorcount=2%
      \ignorespaces\csname author0\endcsname and \csname author1\endcsname\unskip\unskip\unskip%
    \else%
      \@whilenum\tempcount<\tempauthorcount
      \do{%
        \csname author\the\tempcount\endcsname,\ %
        \global\advance\tempcount1%
      }%
      and \csname author\the\tempcount\endcsname\unskip\unskip\unskip\unskip%
    \fi%
  \fi%
}%
%

\def\printauthor{\noindent\@author\endgraf}

\def\affiliation{\@ifnextchar[{\@@affiliation}{\@@affiliation[]}}


\def\@@affiliation[#1]#2{\gdef\@affoptarg{#1}%
  \gdef\au@data{no}%
  \global\advance\affiliationcount1%
  \expandafter\gdef\csname affiliation\the\affiliationcount\endcsname{\textsuperscript{#1}#2}%
}

\def\printaffilitem{\noindent\csname affiliation\the\tempcount\endcsname\unskip\ignorespaces\unskip\unskip\unskip\unskip\unskip\unskip\@@par}

\def\printaffiliation{\itshape\parindent=0pt\def\baselinestretch{1}%
  \global\tempcount0%
  \global\tempaffilcount\affiliationcount
  \global\advance\tempaffilcount-1
  \@whilenum\tempcount<\tempaffilcount
  \do{%
    %\refstepcounter{afrfilnote}%
    {\printaffilitem}%
  \global\advance\tempcount1}%
  %\refstepcounter{afrfilnote}%
  % {\noindent\csname affiliation\the\tempcount\endcsname\unskip\unskip\unskip\unskip\unskip\unskip\@@par}%
  {\printaffilitem}%
  \global\authorcount0
  \global\tempauthorcount0
}

\def\corsnotes{}

\def\corresnotes{\@ifnextchar[{\@@CORRS}{\@@CORRS[]}}

\newcount\crspcnt
\newcount\auncnt
\newcount\biocnt


\def\@@CORRS[#1]#2{\advance\crspcnt by 1\g@addto@macro\corsnotes{\ifnum\the\crspcnt>1\vspace*{3pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\AUnotes{}

\def\aunotes{\@ifnextchar[{\@@AUNOTES}{\@@AUNOTES[]}}

\def\@@AUNOTES[#1]#2#3{\advance\auncnt by 1\g@addto@macro\AUnotes{\ifnum\the\auncnt>1\else\vspace*{6pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\AUBIO{}

\def\bio{\@ifnextchar[{\@@BIO}{\@@BIO[]}}

\def\@@BIO[#1]#2{\advance\biocnt by 1\g@addto@macro\AUBIO{\ifnum\the\biocnt>1\else\vspace*{6pt}\fi\noindent$^{{#1}}$#2\endgraf}}

\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \let \footnote \thanks
  \noindent{\large \@supertitle \par}\vspace*{12pt}
  \noindent{\LARGE \@title \par}
  \ifx\@substitle\@empty
  \else
    \printsubtitle%
  \fi 
  \vskip 1.5em%
  {%
    \printauthor%
    \vspace*{6pt}
    {\noindent\printaffiliation\par}%
    \if!\corsnotes!
    \else
      \vspace*{6pt}%
      %\begin{mybox}[colback=white]{Correspondence details}
      {\small\corsnotes\endgraf}%
      %\end{mybox}
    \fi%
    \if!\AUnotes!
    \else
      \vspace*{6pt}%
      %\begin{mybox}[colback=white]{Author Notes}
      {\small\AUnotes\endgraf}
      %\end{mybox}
    \fi
    \if!\AUBIO!%
    \else%
      \vspace*{6pt}%
      \begin{mybox}[colback=white]{Author Bio}
        {\small\AUBIO\endgraf}%
      \end{mybox}
    \fi%
  }%
  \par

  \vskip 36pt
}

\endinput

Some of your macros are quite complex and mix calculations and content printing. I've changed that, the content is printed using helper macros, which allows us to insert XML tags. You can then create a simple configuration file for TeX4ht, mytitle.4ht:

\NewConfigure{subtitle}{2}
\pend:def\printsubtitle{\a:subtitle}
\append:def\printsubtitle{\b:subtitle}

\NewConfigure{printauthor}{2}
\pend:def\printauthor{\a:printauthor}
\append:def\printauthor{\b:printauthor}

\NewConfigure{affilitem}{2}
\pend:def\printaffilitem{\a:affilitem}
\append:def\printaffilitem{\b:affilitem}

% 
\NewConfigure{orcid}{1}
\def\:tempa#1{\def\:orcidid{#1}\a:orcid}
\HLet\printorcid\:tempa

\AtBeginDocument{
\Configure{maketitle}
{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="maketitle">}
% reconfigure superscripts inside maketitle
\Configure{textsuperscript}{\HCode{<sup>}\NoFonts}{\EndNoFonts\HCode{</sup>}}
}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
{\HCode{<p class="titleHead">}}{\HCode{</p>}}

\Configure{thanks author date and}{}{}{}{}{}{}{}{}

\Configure{subtitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<p class="subtitle">}}{\HCode{</p>}}

\Configure{printauthor}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="author">}}{\HCode{</div>}}

\Configure{affilitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<p class="affil">}}{\HCode{</p>}}

\Configure{orcid}{\HCode{<orcid>https://orcid.org/\:orcidid</orcid>}}
}

In the first part, it creates new hooks where tags can be inserted using the \Configure command. The hooks are inserted to the content printing macros using \pend:def and \append:def commands, which insert code before and after the original content of the patched macro.

In the second part, inside the \AtBeginDocument command, we configure these hooks using the \Configure command. We execute it here because we want to overwrite original TeX4ht configurations.

This is the result:

head><body>
   <div class='maketitle'>
                                                                  

                                                                  
                                                                  

                                                                  
<p class='titleHead'><span class='cmr-17'>Article Title with </span><span class='cmbx-12x-x-144'>bold </span><span class='cmr-17'>and </span><span class='cmti-12x-x-144'>Itlaic formating </span><span class='cmr-17'>with
Inline formula and with footnote</span></p>
   <p class='subtitle'><span class='cmr-12'>Chapter Subtitle with </span><span class='cmbx-12'>bold </span><span class='cmr-12'>and </span><span class='cmti-12'>formating </span><span class='cmr-12'>and</span>
<!-- l. 25 --><math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>a</mi> <mo class='MathClass-bin' stretchy='false'>+</mo> <mi>b</mi> <mo class='MathClass-rel' stretchy='false'>=</mo> <mi>c</mi></mrow></math>
   </p>
   <div class='author'>Xiaotuo Qiao<sup>1,2</sup><orcid>https://orcid.org/000-000-0000</orcid>, Haifeng Guo<sup>1,3</sup><orcid>https://orcid.org/000-000-0001</orcid>, and Jun Li<sup>3</sup><orcid>https://orcid.org/000-000-0002</orcid>
   </div> <p class='affil'><sup>1</sup><span class='cmti-10'>Department of Chemistry, University of Munich (LMU), 81377 Munich,
Germany</span>
</p><p class='affil'><sup>2</sup><span class='cmti-10'>Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany</span>
</p><p class='affil'><sup>3</sup><span class='cmti-10'>Max Planck Institute for Solid State Research, D-70569 Stuttgart, Germany</span>
</p>
   </div>
<!-- l. 27 --><p class='indent'>   with various subtle distinctions among them. Even the existence theory for
modes is not entirely straightforward: there are already examples in the
literature, and this article will supply further examples, of relatively simple
probability measures that have no mode. It can even be the case that the average
of two disjointly supported unimodal probability measures may have no
mode.
</p>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .