bugtex4ht - Bugs: bug #301, problem breaking URL when using...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #301: problem breaking URL when using tex4ht only

Submitted by:  Nasser M. Abbasi <nma123>
Submitted on:  Sun May 8 20:24:13 2016  
 
Category: NonePriority: 5 - Normal
Severity: 3 - MinorStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri Jul 17 20:26:37 2020, comment #2:

It seems that the CSS solution now works in both Firefox and Webkit based browsers, so I've added it to the sources.

Michal Hoftich <michal_h21>
Project Member
Sun May 8 21:44:27 2016, comment #1:

line breaking in html is and should be up to the browser, not us, as far as i understand it. line breaks in text are obviously not the same, in or out of tables, and there's no reason for urls to break the same way either.

i don't know how to control browser behavior wrt breaking at underscores (in or out of urls).

personally, i despite browsers' newfangled behavior of breaking at hyphens, inside or outside of urls, and wish i could turn it off forever. so i myself am happy that it doesn't break at _'s. :)

i don't know if eitan attempted to make the various sophisticated controls in url.sty for breaking at urls have any effect in html. i can't imagine how to replicate the url.sty algorithms in html, even if one wanted to.

the workaround that comes to mind, such as it is, would be to typeset the url in two pieces and force a line break between them. they could both be \href'd to the full url, maybe.

best,
karl

Karl Berry <karl>
Project Administrator
Sun May 8 20:24:13 2016, original submission:

Full problem description is also posted at

http://tex.stackexchange.com/questions/308309/problem-breaking-url-when-using-tex4ht-only

This problem only shows up when compiling to HTML.

I have some long URL's and a URL with underscore does not break inside a table cell when compiled to HTML as it does when compiled to PDF. Long URL with hyphens does break correctly. It is only the ones with underscore that do not break as expected.

MWE follows compiled with TL 2015

------------------------------------------
\documentclass[12pt]{article}%
\usepackage{longtable}
\usepackage{hyperref}
\makeatletter %from http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\g@addto@macro{\UrlBreaks}{\UrlOrds}
\makeatother

%\usepackage[hyphenbreaks]{breakurl}
%\usepackage[hyphens]{url}

\begin{document}
\begin {longtable}{|p{.2in}|p{2.2in}|p{1in}|p{.8in}|}\hline
1&
\url{http://www.foo.com/questions/aaaaaa/aaaaaaa-aa-aaa-aaaaaaaaa-aaaaaaaaaa-aaaaa-aa-aaaaaaa-aaaaaa}
&
more&1/5/2016
\\\hline
\end{longtable}

Another table

\begin {longtable}{|p{.2in}|p{2.2in}|p{1in}|p{.8in}|}\hline
2&
\url{https://www.foo.com/post/aaa_aaa_aaaa_aaaaaaaa_aaaaa_aa_aaaaaaaaa_aaaaaa_aaa_aaa_aaaaaaaaa_aa_aaaaaaa_aaa_aaaaaaaa_aaaaaaa}
&another good question&1/5/2016\\\hline
\end{longtable}
another one

\begin {longtable}{|p{.2in}|p{2.2in}|p{1in}|p{.8in}|}\hline
1&
aaaaaa aaaaaaa aa aaa aaaaaaaaa aaaaaaaaaa aaaaa aa aaaaaaa
aaaaaa aaaaa aaaaaaaaaa aaaaaaaa aaaaa aaaaaa
aaaaaa aaaaaaa aa aaa aaaaaaaaa aaaaaaaaaa aaaaa aa aaaaaaa
&more&1/5/2016
\\\hline
\end{longtable}
\end{document}
----------------------------

When compiled to PDF, the middle URL breaks correctly, but not when compiled to html, using either make4ht or htlatex

htlatex foo.tex "htm,p-width"

I think the URL should break the same way as it does in PDF. May be there is a workaround?

Nasser M. Abbasi <nma123>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by michal_h21 (Posted a comment)
  • -unavailable- added by karl (Posted a comment)
  • -unavailable- added by nma123 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    1 latest change follows.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Jul 17 20:26:37 2020michal_h21Open/ClosedOpen=>Closed
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup+gray