Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabto package #116

Closed
danielezambelli opened this issue Mar 31, 2023 · 5 comments
Closed

tabto package #116

danielezambelli opened this issue Mar 31, 2023 · 5 comments

Comments

@danielezambelli
Copy link

Hi

I think the "tabto" package is not yet supported:

When there is a "\tab" command in place of a tab, an image is inserted from among the many .svg present.

Thank you.

@michal-h21
Copy link
Owner

Yes, it isn't supported. I haven't heard about this package before. Do you have a MWE?

@danielezambelli
Copy link
Author

I used the "tabto" package in my text, but I don't know if it was a good choice; it seemed simple enough and does what I needed.

An MWE is as follows:

%--8<-------------------------------------
\documentclass[10pt,a4paper]{memoir}
\RequirePackage[italian]{babel}

\RequirePackage[usenames, dvipsnames]{xcolor}   % gestione colori
\RequirePackage[colorlinks, hyperindex, pagebackref,
                linkcolor=RoyalBlue, filecolor=RoyalBlue,
                citecolor = black, urlcolor=RoyalBlue]{hyperref}

\RequirePackage{amsmath, amssymb, amsthm}
\RequirePackage{tikz}
\usetikzlibrary{
  arrows,%
  arrows.meta,
  through,
  automata,%
  backgrounds,%
  calc,%
  circuits.ee.IEC,
  decorations.markings,%
  decorations.shapes,%
  decorations.text,%
  decorations.pathreplacing,%
  fit,%
  matrix,%
  mindmap,%
  patterns,%
  positioning,%
  intersections,%
  shapes,%
  shapes.geometric,
}
\RequirePackage[most]{tcolorbox}
\RequirePackage[inline]{enumitem} % elenchi
\RequirePackage{multicol} % testo su più colonne
\RequirePackage{tabto} % testo su più colonne

\usepackage{iftex}
\ifpdftex\typeout{************* PDFTeX*****************}
  \RequirePackage[T1]{fontenc}
  \RequirePackage[utf8]{inputenc}% non più necessario, ma non disturba
  \RequirePackage{stix2} % font

\else
  \ifluatex\typeout{************* LuaLaTeX *****************}
    \usepackage{fontspec}
    \setmainfont{STIX}[Ligatures=TeX]
    \usepackage[math-style=ISO]{unicode-math}
    \setmathfont{STIX Two Math}
  \fi
\fi

\usepackage{lipsum}

\newcommand{\disegno}[2][5]{% Inizializza un disegno
  % Sintassi: \disegno[dimensione unità]{comandi grafici}
  % Esempi di chiamata:
  % \disegno{\draw (0, 0) -- (4, 6);}
  % \disegno[3]{\draw (0, 0) -- (4, 6);}
\begin{tikzpicture}[x=#1 mm, y=#1 mm, smooth, line cap=round]
  #2
\end{tikzpicture}
}

\NewDocumentCommand \rcomvar{s O{black} m m m m m m}{
  % Riferimento Cartesiano Ortogonale Monometrico.
  % Se c'è l'asterisco non viene disegnata la griglia.
  % Sintassi: \rcomvar[*][parametri]{xi}{xf}{yi}{yf}{varasc}{varord}
  % Esempio di chiamata:
  %% \disegno{\rcomvar*{-7}{+7}{-11}{+10}{t}{s}
  %% \disegno{\rcomvar{-7}{+7}{-11}{+10}{t}{s}
  \IfBooleanF{#1}
    {\draw[gray!50, very thin, step=1]
      (#3-0.3, #5-0.3) grid (#4+0.3, #6+0.3);}
  \begin{scope}[-{Stealth[length=2mm, open, round]}, #2] % Assi
    \draw (#3-0.3, 0) -- (#4+0.5, 0)
      node [below, xshift=-3pt] {$#7$};
    \draw (0, #5-0.3) -- (0, #6+0.5)
      node [left, yshift=-3pt] {$#8$};
  \end{scope}
}

\NewDocumentCommand \rcom{s O{black} m m m m}{
  % Riferimento Cartesiano Ortogonale Monometrico.
  % Se c'è l'asterisco non viene disegnata la griglia.
  % Sintassi: \rcomvar[*][parametri]{xi}{xf}{yi}{yf}
  % Esempio di chiamata:
  %% \disegno{\rcom*{-7}{+7}{-11}{+10}
  %% \disegno{\rcom{-7}{+7}{-11}{+10}
  \IfBooleanTF{#1}
    {\rcomvar*[#2]{#3}{#4}{#5}{#6}{x}{y}}
    {\rcomvar[#2]{#3}{#4}{#5}{#6}{x}{y}}
}

\newenvironment{alternativetext}[1]{}{}

\NewDocumentCommand \immagine{s O{1} m m}{
  % Macro for placing image with:
  % - Alternative text,
  % - scale (default value: 1),
  % - centered without an asterisk, with asterisk does NOT center the image.
  % Examples:
  %% \immagine{}{}
  %% \immagine{Alternative text}{\miaimmagine}
  %% \immagine[.5]{Alternative text}{\miaimmagine}
  %% \immagine*[.5]{Alternative text}{\miaimmagine}
  %
  \begin{alternativetext}{#3}
  \IfBooleanF{#1}
    {\begin{center}}
  \scalebox{#2}{#4}
  \IfBooleanF{#1}
    {\end{center}}
  \end{alternativetext}
}

\DeclareRobustCommand{\Z}{\mathbb{Z}}

\newcommand{\tonda}[1]{\left( #1 \right)}

\newcommand{\quadra}[1]{\left[ #1 \right]}

\newcommand{\Deriv}[1]{\mathit{D}\quadra{#1}}

\newcommand{\immaginea}{
  \disegno{
    \rcom{-4}{+4}{-4}{+3}
    \filldraw (-3, -3) circle(2pt) node[below right]{$A$};
  }
}

\newcommand{\immagineb}{
  \disegno{
    \rcom{-4}{+4}{-4}{+3}
    \filldraw (-2, -2) circle(2pt) node[below right]{$B$};
  }
}

\newcommand{\immaginec}{
  \disegno{
    \rcom{-4}{+4}{-4}{+3}
    \filldraw (-1, -1) circle(2pt) node[below right]{$C$};
  }
}

\newcommand{\immagined}{
  \disegno{
    \rcom{-4}{+4}{-4}{+3}
    \filldraw (0, 0) circle(2pt) node[below right]{$D$};
  }
}

\newcommand{\immaginee}{
  \disegno{
    \rcom{-4}{+4}{-4}{+3}
    \filldraw (+1, +1) circle(2pt) node[below right]{$E$};
  }
}

\newcommand{\immaginef}{
  \disegno{
    \rcom{-4}{+4}{-3}{+4}
    \filldraw (-3, +3) circle(2pt) node[below right]{$F$};
  }
}

\newcommand{\immagineg}{
  \disegno{
    \rcom{-4}{+4}{-3}{+4}
    \filldraw (-2, +2) circle(2pt) node[below right]{$G$};
  }
}

\newcommand{\immagineh}{
  \disegno{
    \rcom{-4}{+4}{-3}{+4}
    \filldraw (-1, +1) circle(2pt) node[below right]{$H$};
  }
}

\newcommand{\immaginei}{
  \disegno{
    \rcom{-4}{+4}{-3}{+4}
    \filldraw (0, 0) circle(2pt) node[below right]{$I$};
  }
}

\newcommand{\immaginej}{
  \disegno{
    \rcom{-4}{+4}{-3}{+4}
    \filldraw (+1, -1) circle(2pt) node[below right]{$J$};
  }
}

\begin{document}

\chapter{Derivata}

\section{Alcune immagini}

\immagine{}{\immaginea}

\immagine{}{\immagineb}

\immagine{}{\immaginec}

\immagine{}{\immagined}

\immagine{}{\immaginee}


\section{Alcune regole di derivazione}

Abbiamo dimostrato le regole di derivazione per alcune funzioni elementari: 
\begin{enumerate} [noitemsep]
\item \(\Deriv{k} = 0\) \tab  derivata di una costante;
\item \(\Deriv{x} = 1\) \tab derivata della funzione identica;
\item \(\Deriv{\dfrac{1}{x}} = -\dfrac{1}{x^2}\) 
  \tab  derivata della funzione reciproco;
\item \(\Deriv{\sqrt{x}} = \dfrac{1}{2\sqrt{x}}\) 
  \tab  derivata della radice quadrata;
\item \(\Deriv{x^z} = z x^{z-1}\) 
  \tab  derivata della funzione potenza (\(z \in \Z\)).
\end{enumerate}

\immagine{}{\immaginef}

\immagine{}{\immagineg}

\immagine{}{\immagineh}

\immagine{}{\immaginei}

\immagine{}{\immaginej}


\end{document}
%--8<-------------------------------------

At the end of the compilation with:

make4ht tab.tex -f html5-common_domfilters -c ml_make4ht -l -u -s -d ./html/mathjax "mathjax, 3, sec-filename, fn-in, blind"

you get error messages about non-existent .svg files.

But if in the dir where the produced files are moved, there are .svg files, maybe created by the compilation of some previous file, it inserts these files instead of tabs.

Thanks

@michal-h21
Copy link
Owner

I'was able to remove image warnings with the following tabto.4ht file:

\NewConfigure{tabto}{1}
\NewConfigure{tabtos}{1}
\ProvideDocumentCommand\tabto:fourht{sm}{\def\Htabsize{\the\dimexpr#2\relax}\IfBooleanTF {#1}{\a:tabtos}{\a:tabto}}
\HLet\tabto\tabto:fourht
\Configure{tabto}{\HCode{<span class="tabto" style="width:\Htabsize;"></span>}}
\Configure{tabtos}{\HCode{<span class="tabto" style="width:\Htabsize;"></span>}}
\Css{.tabto{display: inline-block;}}

\Hinput{tabto}
\endinput

However, it cannot work as in the PDF output because HTML doesn't support this tabbing feature. So at best, you will get a fixed-length space.

@danielezambelli
Copy link
Author

Thank you!!!

tabto.4ht works fine.

How can it be done to leave a larger space?

@michal-h21
Copy link
Owner

You can change the min-width CSS value, like in this configuration file:

\Preamble{xhtml}
\Configure{tabto}{\HCode{<span class="tabto" style="width:\Htabsize;min-width:3em;"></span>}}
\begin{document}
\EndPreamble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants