[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#550381: marked as done (tex4ht: Creates invalid html document)



Your message dated Sat, 6 Aug 2022 14:43:16 +0200
with message-id <91e0aa19-9344-3282-f02b-6a0043f3c227@web.de>
and subject line Re: Bug#550381: tex4ht: Creates invalid html document
has caused the Debian Bug report #550381,
regarding tex4ht: Creates invalid html document
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
550381: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550381
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: tex4ht
Version: 20090611-1+b1
Severity: normal

Hello!

htlatex produces invalid html document if the source contains
\AtBeginDocument directive. Minimal example and result html file
attached.

Hope the fix is easy,
Andrey Paramonov

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (1000, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-2-686 (SMP w/1 CPU core)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tex4ht depends on:
ii  libc6                      2.9-25        GNU C Library: Shared libraries
ii  libkpathsea4               2007.dfsg.2-7 TeX Live: path search library for 
ii  tex4ht-common              20090611-1    LaTeX and TeX for Hypertext (HTML)
ii  texlive-base-bin           2007.dfsg.2-7 TeX Live: Essential binaries

tex4ht recommends no packages.

tex4ht suggests no packages.

-- no debconf information

===File ~/test.tex==========================================
\documentclass[english]{minimal}
\usepackage[utf8]{inputenc}

\makeatletter
\AtBeginDocument{\@title}
\makeatother

\title{Minimal example}

\begin{document}

Test body.

\end{document}
============================================================

===File ~/test.html=========================================
<span 
class="cmr-10">Minimal example</span><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd";>  
<html > 
<head><title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<!-- html --> 
<meta name="src" content="test.tex"> 
<meta name="date" content="2009-10-09 22:05:00"> 
<link rel="stylesheet" type="text/css" href="test.css"> 
</head><body 
>
<!--l. 12--><p class="noindent" >Test body.
     
</body></html>

============================================================



--- End Message ---
--- Begin Message ---
Control: tags -1 + wontfix
Control: notforwarded -1

Am 09.10.2009 um 20:14 teilte Andrey mit:

Hi,

I got no fix, but rather an explanation why it fails and how to work around. I tag the bug as won't fix. Feel free to close.

htlatex produces invalid html document if the source contains
\AtBeginDocument directive. Minimal example and result html file
attached.


The `\AtBeginDocument` command is usually used to redefine macros and initialize stuff. This use works. What is the issue in this case is that it includes a text in the document. As tex4ht outputs the HTML header at this moment as well, it happens that the text goes before HTML.

I don't think we can fix that easily, as we want the code usually executed in `\AtBeginDocument` to be executed before any output is written. In this particular case, I would advice to edit the document:

-----------
\documentclass[english]{minimal}
\usepackage[utf8]{inputenc}

\newcommand\outputatbegin[1]{#1}

\makeatletter
\AtBeginDocument{\outputatbegin{\@title}}
\makeatother
\title{Minimal example}
\begin{document}
Test body.
\end{document}
------------

The `\outputbegin` command can then be redefined for tex4ht in a custom config file:

-------------
\Preamble{xhtml}
\renewcommand\outputatbegin[1]{\Configure{@BODY}{#1}}
\begin{document}
\EndPreamble
-------------

The redefinition uses the `\Configure{@BODY}` command that will output the text after the `<body>` tag.

--
sigfault

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


--- End Message ---

Reply to: