bugtex4ht - Bugs: bug #552, Unwanted space at \hspace{0pt}

 
 
Show feedback again

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

bug #552: Unwanted space at \hspace{0pt}

Submitted by:  Taichi Kato <tk2022>
Submitted on:  Wed Feb 9 00:45:01 2022  
 
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Wed Oct 4 12:25:48 2023, comment #7:

This can also be closed, I hope.

Michal Hoftich <michal_h21>
Project Member
Fri Feb 11 08:46:26 2022, comment #6:

You can do something like this:

%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt,a4paper]{article}

\usepackage[comma,colon]{natbib}
\newcommand\possiblebreak{\hspace{0pt}}

\begin{document}

\begin{thebibliography}{}

\bibitem[{Gulf News}(2021)]{gul21OHB}
{Gulf News} (2021) {Video: A rare migratory bird rescued by Dubai resident
(2021 May 20).}
Downloaded from https://gulfnews.com/\possiblebreak uae/\possiblebreak environment/\possiblebreak video-a-rare-migratory-bird-rescued-by-dubai-resident-1.79307000.

\end{thebibliography}

\end{document}
%%%%%%%%%%%%%%%%%

And then redefine the \possiblebreak in the .cfg file:

%%%%%%%%%%
\Preamble{xhtml}
\renewcommand\possiblebreak{\nobreak}
\begin{document}
\EndPreamble
%%%%%%%%%%

Michal Hoftich <michal_h21>
Project Member
Thu Feb 10 23:45:39 2022, comment #5:

Thank you. The compilation with make4ht passed.

Redefining the \hspace trick would be promising for me (since
I can control the locations of the possible breaks).

I will try with more URLs to see whether Breakurl gives
reasonable results with for platex and make4ht.
(In my ordinary journal submissions, the style files are for
platex or pdflatex, but some journals require .docx.
I want to use the same .bib file to produce reasonable outputs
for the both).

Taichi Kato <tk2022>
Thu Feb 10 16:43:40 2022, comment #4:

It seems that the Breakurl package inserts some PostScript code in the DVI mode. This causes TeX4ht error. It should be fixed with the attached usepackage.4ht and breakurl-hooks.4ht files.

Regarding the \hspace trick, you could also define a custom command for this purpose, and redefine it to do nothing with TeX4ht. But in general, I think that \url is better. It is weird that it doesn't break with platex. Unfortunatelly I am not familiar with this engine.

(file #505, file #506, file #507)

Michal Hoftich <michal_h21>
Project Member
Thu Feb 10 02:59:44 2022, comment #3:

The next one (test10-1.tex, also attached) was fine with
platex, but make4ht resulted an error.

[ERROR] htlatex: Compilation errors in the htlatex run
[ERROR] htlatex: Filename Line Message
[ERROR] htlatex: /usr/share/texlive/texmf-dist/tex/generic/tex4ht/mathml.4ht 1390 Undefined control sequence.

%%%
\documentclass[12pt,a4paper]{article}

\usepackage[comma,colon]{natbib}
\usepackage{hyperref}
\usepackage{breakurl}

\begin{document}

\begin{thebibliography}{}

\bibitem[{Gulf News}(2021)]{gul21OHB}
{Gulf News} (2021) {Video: A rare migratory bird rescued by Dubai resident
(2021 May 20).}
Downloaded from \url{https://gulfnews.com/uae/environment/video&a=1&rare=2&mig
ratory=3&bird=4&rescued=5&by=6&dubai=7&resident=1.79307000}.

\end{thebibliography}

\end{document}

(file #504)

Taichi Kato <tk2022>
Thu Feb 10 00:20:31 2022, comment #2:

I tried with test10.tex and obtained different results
between teX4ht (test10.odt) and platex (test10.pdf).
The long URL line is not broken by platex.
I wanted to specify where to break (such as after &)
by using \hspace{0pt}. This worked as desired in platex,
but not in teX4ht.

If there is a good tip to produce similarly broken
long URLs by teX4ht and platex from the same .tex source,
I would be happy to know it.

(file #500, file #501, file #502)

Taichi Kato <tk2022>
Wed Feb 9 08:29:06 2022, comment #1:

TeX4ht doesn't do anything with \hspace. The issue here is that the link is broken into two lines, and LO displays the line break as space:

I would use the \url{} command. It handles line breaks in PDF automatically, and it works correctly in TeX4ht. Moreover, you will get a clickable link.

Michal Hoftich <michal_h21>
Project Member
Wed Feb 9 00:45:01 2022, original submission:

Unnecessary spaces are inserted at \hspace{0pt}.
(platex-compiled test9.pdf is also attached).

%%%
\documentclass[12pt,a4paper]{article}

\usepackage[comma,colon]{natbib}

\begin{document}

\begin{thebibliography}{}

\bibitem[{Gulf News}(2021)]{gul21OHB}
{Gulf News} (2021) {Video: A rare migratory bird rescued by Dubai resident
(2021 May 20).}
Downloaded from https://gulfnews.com/\hspace{0pt}uae/\hspace{0pt}environment/\hspace{0pt}video-a-rare-migratory-bird-rescued-by-dubai-resident-1.79307000.

\end{thebibliography}

\end{document}

Taichi Kato <tk2022>

 

Attached Files
file #505:  usepackage.4ht added by michal_h21 (3kB - application/octet-stream)
file #506:  breakurl-hooks.4ht added by michal_h21 (107B - application/octet-stream)
file #507:  break.odt added by michal_h21 (7kB - application/vnd.oasis.opendocument.text)
file #504:  test10-1.tex added by tk2022 (475B - text/x-tex)
file #500:  test10.tex added by tk2022 (453B - text/x-tex)
file #501:  test10.pdf added by tk2022 (10kB - application/pdf)
file #502:  test10.odt added by tk2022 (7kB - application/vnd.oasis.opendocument.text)
file #498:  test9.odt added by tk2022 (7kB - application/vnd.oasis.opendocument.text)
file #499:  test9.pdf added by tk2022 (7kB - application/pdf)

 

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 tk2022 (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):

     

     

    10 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Oct 4 12:25:48 2023michal_h21Open/ClosedOpen=>Closed
    Thu Feb 10 16:43:40 2022michal_h21Attached File-=>Added usepackage.4ht, #505
      Attached File-=>Added breakurl-hooks.4ht, #506
      Attached File-=>Added break.odt, #507
    Thu Feb 10 02:59:44 2022tk2022Attached File-=>Added test10-1.tex, #504
    Thu Feb 10 00:20:31 2022tk2022Attached File-=>Added test10.tex, #500
      Attached File-=>Added test10.pdf, #501
      Attached File-=>Added test10.odt, #502
    Wed Feb 9 00:45:01 2022tk2022Attached File-=>Added test9.odt, #498
      Attached File-=>Added test9.pdf, #499
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup+gray