2

edit: @michal.h21 I attempt to include a cfg file (named cfg), as you suggest, in my tex file alt.tex. I run the command: make4ht -ul alt.tex "cfg.cfg" but it does not change a thing.

I changed thus my alt.tex in adding

 \ifx\HCode\undefined \else
 \Css{body{background-color:green;}}
\Css{.list3 *, .list4 *, .list5  *, .list6  *{display:inline;}}
 \ConfigureEnv{quote}{\Tg<quote>}{\Tg</quote>}{}{}
 \fi

please add also a personal list with normal items

\vspace{1cm}
\textbf{THIS IS WHAT i WANT IN PDF AND HTML:}

PERSONAL LIST THROUGH THE GENERIC LIST ENV. \quad [the alignment fails in the HTML version]
\begin{personallist2}
\item personal  list with normal item \begin{personallist2}
\item personal  list with normal item\begin{personallist2}\setcounter{list3}{33}
\item string of text
\end{personallist2}
\end{personallist2}
\end{personallist2}

which outputs

http://i.imgur.com/lTiZwI3.png

which means that even personal lists with normal items are displayed on ONE line.

========================= end of edit ========================

Edit: I wish to avoid the package enumitem and other list packages as much as I can, since my code must be compatible on various computers which do not have internet nor the fanciest packages.

the list enumerate has a very good property, to wit that nested enumerate lists are displayed on one line when the items are the subsequent list itself, instead of some usual strings of letters.

I want to create a personal list [depth is three] in order to control the labels and the spacings, as in any personal list, but the environment \begin{list} does not offer the good property of enumerate.

I define \personallist in copy-pasting the definition of enumerate, but we notice that the left margin for \personallist does not behave as the left margin for enumerate.

QUESTION

How do I implement the nesting on ONE line from enumerate in my recursion defining my personallist2 which have all the spacing that I like ?

I compile with xelatex or lualatex, but the problem holds without fontspec and other packages for these engines.

If you want to compile with lualatex, Install helpersht from https://github.com/michal-h21/helpers4ht by @michal.h21

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


\usepackage{alternative4ht}
\altusepackage{polyglossia}
\altusepackage{fontspec}


%recursion
\newcounter{listlvl}
\setcounter{listlvl}{-1}
%counter by level
\newcounter{list1}
\setcounter{list1}{0}
\newcounter{list2}
\setcounter{list2}{0}
\newcounter{list3}
\setcounter{list3}{0}
\newenvironment{personallist2}
{
%add one level
\addtocounter{listlvl}{1}
%test the level
\ifcase\value{listlvl}
% level = 0
\begin{list}
{
{\alph{list1}}
}
{
\setlength{\leftmargin}{\leftmargini}
\setlength{\labelsep}{0ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus  0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\usecounter{list1}
}
% level = 1
\or
\begin{list}
{\textbf{\alph{list2}}\large)\normalsize}
{
\setlength{\leftmargin}{\leftmarginii}
\addtolength{\leftmargin}{-0.5\leftmargini}
\setlength{\labelsep}{0.5ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus  0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\usecounter{list2}
}
% level = 2
\or
\begin{list}
{\textit{\roman{list3}}\large)\normalsize}
{
\setlength{\leftmargin}{\leftmarginiii}
\addtolength{\leftmargin}{-0.5\leftmarginii}
\setlength{\labelsep}{0.5ex}
\setlength{\itemindent}{1\parindent}
\setlength{\listparindent}{1\parindent}
\setlength{\parsep}{1\parskip}
\setlength{\itemsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\setlength{\topsep}{0\parskip plus  0.25\parskip minus 0.25\parskip}
\setlength{\partopsep}{0\parskip plus 0.25\parskip minus 0.25\parskip}
\usecounter{list3}
}
\else
%   \begin{list}
%    {***
%    }
%    {
%    }
\fi
}
{\end{list}
%down of level
\addtocounter{listlvl}{-1}
}







\makeatletter
\def\personallist{%
  \ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
  \@ifnextchar[{\@@enum@}{\@enum@}}
\def\@@enum@[#1]{%
  \@enLab{}\let\@enThe\@enQmark
  \@enloop#1\@enum@
  \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
   ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
  \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
  \expandafter\let\csname the\@enumctr\endcsname\@enThe
  \csname c@\@enumctr\endcsname7
  \expandafter\settowidth
            \csname leftmargin\romannumeral\@enumdepth\endcsname
            {\the\@enLab\hspace{\labelsep}}%
  \@enum@}
\def\@enum@{\list{\csname label\@enumctr\endcsname}%
           {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}}
\makeatother

\begin{document}

COMPLETELY GENERIC LIST \quad [the alignment fails in the HTML version]
\begin{list}{label1}{spacing}
\item \begin{list}{label2}{spacing}
\item \begin{list}{label3}{spacing}
\item string of text
\end{list}
\end{list}
\end{list}
\vspace{1cm}


ENUMERATE \quad [the alignment succeeds in the HTML version]
\begin{enumerate}
\item \begin{enumerate}
\item \begin{enumerate}\setcounter{enumiii}{33}
\item string of text
\end{enumerate}
\end{enumerate}
\end{enumerate}
\vspace{1cm}

PERSONAL LIST THROUGH ENUMERATE \quad [the alignment succeeds in the HTML version, but there is no creation of a new line !]
\begin{personallist}
\item \begin{personallist}
\item \begin{personallist}\setcounter{enumiii}{33}
\item string of text
\end{personallist}
\end{personallist}
\end{personallist}

\vspace{1cm}

\textbf{THIS IS WHAT i WANT IN PDF AND HTML:}
PERSONAL LIST THROUGH THE GENERIC LIST ENV. \quad [the alignment fails in the HTML version]
\begin{personallist2}
\item \begin{personallist2}
\item \begin{personallist2}\setcounter{list3}{33}
\item string of text
\end{personallist2}
\end{personallist2}
\end{personallist2}






\end{document}

compile with make4ht -ul filename.tex

PDF RESULT

HTML RESULT

1
  • your use of "cfg.cfg", you should use either make4ht -c cfg.cfg -ul filename or make4ht -ul filename "cfg". see the edit
    – michal.h21
    Dec 7, 2015 at 18:15

1 Answer 1

1

You can just adjust some CSS properties in your case, try this .cfg file:

\Preamble{xhtml}
\Css{.list3 *, .list4 *, .list5  *, .list6  *{display:inline;}}
\begin{document}
\EndPreamble

compile with

make4ht -ul -c cfg.cfg filename.tex

enter image description here

regarding your edit, I would use different list environments for empty lists and lists with text, or maybe even some simpler syntax for one line lists, like \oneline{3}{string of text} (I think definition of such macro should be easier than the one for personallist2 :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .