I'm working with tex4ht (htlatex) and I'm trying to put links into the page it generates. I'm trying to find a way to make it so that when I place a link in the page the link is generated to have the target set to _blank
. The reason for this is so that I can have these links open in a new tab.
Here is the code I have in the .tex
file
\href{www.somesite.com}{The text}
Here is what it generates
<a href="www.somesite.com">The text</a>
Here is what I'd like to generate for all links except the cross links
<a href="www.somesite.com" target="_blank">The text</a>
I know there are ways to use \Configure
but I can't seam to make them change the code generation at all.
Best Answer
You can redefine
\href
command in the custom config file to include that attribute. Create filehello.cfg
:this definition is modified macro from
tex4ht
sources.\let~\H@tilde
is needed for support urls in form ofsomething.com/~username/whatewer.html
.\Link
command has syntax:you don't need
internal link
anddeclare internal link
in your case, it is useful for crossreferences in the document.compile your document with
and the result: