[tex4ht] How to make tex4ht insert <BR> without adding <P> also?

Nasser M. Abbasi nma at 12000.org
Mon Sep 23 08:14:15 CEST 2024


Hello;

I found a workaround which works great for me.

Instead of doing

\ifdefined\HCode
\HCode{<BR>}
\fi

I tried

\ifdefined\HCode
\HCode{}
\fi

And this generated an empty paragraph. Which as a side effect, happend
to make the exact vertical space I wanted.

The main issue was that tex4ht puts no space after the
local TOC and the main text of the section, which makes the
page look little ugly.

I wanted a way to increase the vertical space between the TOC and main
text a little. All other things I tried was making the vertical
space too large.

The above gave me the perfect vertical space I wanted.
So I am ok now.

Thanks,
--Nasser


On 9/22/2024 11:57 PM, Nasser M. Abbasi wrote:
> I want to insert <BR> at specific place in HTML. Directly into the html.
> 
> tex4ht does that using \HCode, but it puts the <BR> inside <P> which now
> makes the vertical space much larger than it would be with just <BR> on
> its own.
> 
> Here is MWE. I do not want to use .cfg or .4ht or any other tricks.
> I simply want to insert raw <BR> directly from the latex at the location
> I want.
> 
> ----------------
> \documentclass[12pt]{article}%	
> \begin{document}
> \ifdefined\HCode	
> \TocAt{section,subsection}
> \fi
> \section{A}
> % want <BR> here in HTML which will be below TOC of section
> \ifdefined\HCode
> \HCode{<BR>}
> \fi
> %
> \subsection{A1}
> some text
>    	
> \end{document}
> ------------------------
> 
> Compiled using
> 
> make4ht -ulm default -a debug A.tex 'mathjax,htm'
> 
> Gives the A.htm as this
> 
> <div class='sectionTOCS'>
> <span class='subsectionToc'>1.1 <a href='#a1' id='QQ2-1-2'>A1</a></span>
> </div>
> <!-- l. 13 --><p class='indent'>   <BR /></p>
> 
> The TOC is because I asked it to generate toc for each section.
> 
> THe problem is the line below which is
> 
> <!-- l. 13 --><p class='indent'>   <BR /></p>
> 
> I wanted it to be just
> 
>         <BR>
> 
> Why? Becuase now the vertical space is less. Which is what I want.
> 
> <p class='indent'>   <BR /></p>
> 
> Makes the vertical space more. I also did not ask it to put <BR>
> inside <P> so why did it do it?
> 
> Is there a way to tell tex4ht to insert <BR> using \HCode from
> inside latex like I did, without it being inside <P> also?
> 
> Thank you,
> --Nasser



More information about the tex4ht mailing list.