TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I generate latex with the following format in latex? I know about tex4ht and I know about latex4html but couldn't get similar output.

Source Website is here and a snapshot from the page is given below

enter image description here

Sample Tex File (Notice the tables in the above link)


           {babel}        % needed for iso dates
           {isodate}      % use iso format for dates
           {listings}     % code listings


% Base definitions for tables

%% vertical alignment
 \newcommand{\rb}[1]{\raisebox{1.5ex}[0pt]{##1}}    % move argument up half a row

%% header helpers
 \newcommand{\hdstyle}[1]{\textbf{##1}}             % set header style
 \newcommand{\Head}[3]{\multicolumn{##1}{##2}{\hdstyle{##3}}}   % add title spanning multiple columns
 \newcommand{\lhdrx}[2]{\Head{##1}{|c}{##2}}        % set header for left column spanning #1 columns
 \newcommand{\chdrx}[2]{\Head{##1}{c}{##2}}         % set header for center column spanning #1 columns
 \newcommand{\rhdrx}[2]{\Head{##1}{c|}{##2}}        % set header for right column spanning #1 columns
 \newcommand{\ohdrx}[2]{\Head{##1}{|c|}{##2}}       % set header for only column spanning #1 columns
 \newcommand{\lhdr}[1]{\lhdrx{1}{##1}}              % set header for single left column
 \newcommand{\chdr}[1]{\chdrx{1}{##1}}              % set header for single center column
 \newcommand{\rhdr}[1]{\rhdrx{1}{##1}}              % set header for single right column
 \newcommand{\br}{\hfill\break}                     % force newline within table entry

%% column styles
 \newcolumntype{x}[1]{>{\raggedright\let\\=\tabularnewline}p{##1}}  % word-wrapped ragged-right
                                                                    % column, width specified by #1
 % \newcolumntype{m}[1]{>{\CodeStyle}l{##1}}              % variable width column, all entries in CodeStyle
 \newcolumntype{m}[1]{l{##1}}                           % variable width column, all entries in CodeStyle

% General Usage: TITLE is the title of the table, XREF is the
% cross-reference for the table. LAYOUT is a sequence of column
% type specifiers (e.g. cp{1.0}c), without '|' for the left edge
% or right edge.

% usage: \begin{floattablebase}{TITLE}{XREF}{COLUMNS}{PLACEMENT}
% produces floating table, location determined within limits
% by LaTeX.

% usage: \begin{floattable}{TITLE}{XREF}{COLUMNS}
% produces floating table, location determined within limits
% by LaTeX.


{Potential \tcode{setlocale} data races}

\tcode{fprintf}     &
\tcode{isprint}     &
\tcode{iswdigit}    &
\tcode{localeconv}  &
\tcode{tolower}     \\


share|improve this question
Which aspect of that site is the one you want? The "plain text" formatting? The fixed-width font? The underlines in the titles? The bracketed [labels] at the sections? Why use latex if the result is not intended for printing? It looks as if nroff or texinfo, or markdown were better alternatives. – JLDiaz Dec 4 '12 at 15:07
actually all of it :). – RamneekHanda Dec 4 '12 at 15:11
Looking at the source code of those pages, you can discover that all the content is basically pre-formatted and included in a big <pre> tag. It looks as if it was written directly in plain text, or processed with nroff. I can't see any relationship with LaTeX. Perhaps you can take some ideas from rfc-editor.org/formatting.html – JLDiaz Dec 4 '12 at 15:17
You can get an nroff editor aaa-sec.com/nroffedit. LaTeX unfortunately cannot be used for badly formatted text, except under duress:) – Yiannis Lazarides Dec 4 '12 at 16:41
unfortunately i have tex files.. so i need something that can convert stuff.. – RamneekHanda Dec 4 '12 at 16:46
up vote 4 down vote accepted

This code relates to project which OP mentioned in the comments.

I would convert files with macro definitions to sty files. So rename files macros.tex, layout.tex, etc. to macros.sty etc. In your main file, call them then with \usepackage. Thanks of that, you can then provide configuration files for tex4ht.

You should rewrite some macros, to be easier for modification. for example. you have in macros.tex this macro:


As with tex4ht you will need to insert there some html tags, it would be better to modify it little bit:



Now you need only to redefine \SecParts macro in your tex4ht config file to insert some html tags. \edef\@currentlabel{_#2_} is here because you wanted cross-references with labels and underscores instead of section numbers.

I created configuration file macros.4ht, where I put some redefinitions:

% hooks definitions 



\Configure{SecParts}{}{\HCode{<span class="SecLabel">[}}{\HCode{]</span>}}
\Configure{Pnum}{\HCode{<span class="pnum">}}{\HCode{</span>}}


 h1, h2, h3{font-size:1em;font-weight:normal;}
\Css{h2 br{display:none}}
     -webkit-hyphens: auto;
     -moz-hyphens: auto;
     hyphens: auto;
display:block; width: 2em; margin-left:-2em; float:left;

With \NewConfigure commands I created configurable hooks, then with \renewcommand I redefined commands where I need to put these hooks. I think you have many macros, where you should use similar redefinitions for inserting html tags, so you can do that this way.

And major part of this file are css definitions which affects appearance.

enter image description here

share|improve this answer
thanks.. will have a look at it later tonight and accept the answer.. i have really made progress thanks to your knowledge :).. – RamneekHanda Dec 12 '12 at 8:12
a quick question though.. is it the complete solution or will i have to go about learning what you have done and replicate it for other sty files? – RamneekHanda Dec 12 '12 at 8:13
@RamneekHanda it is complete solution for general layout, I think. But you will probably want and need to adapt some document markup macros, to be able to assign html tags for their content and to be able to apply CSS styling – michal.h21 Dec 12 '12 at 8:52
Perfect.. though i still get this warning and if i keep pressing ctrl-D.. it eventually does create the document in the form expected... can you help me solve this warning - (./utilities.aux ! Missing \endcsname inserted. <to be read again> \unhbox l.811 ...LiNK{x1-669000_time.traits.is_fp_}{750}}} – RamneekHanda Dec 14 '12 at 16:21
@RamneekHanda I don't know what is the problem, maybe there is some problem with underscore? I know that tex4ht is playing with underscore catcodes – michal.h21 Dec 14 '12 at 17:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.