0

There 2 packages from my last example:

ideje.tex and mypackage.tex

I need to complete this enumerate enviroment from arabic, roman to include hgnum

  begin{enumerate}[label=\roman{enumi}--\arabic{enumi}--\large\ngg\symbol{\numexpr "13000+\value{enumi}}--]%\hgnum{\value{enumi}}]

ideje.tex MWE

\documentclass{article}

\usepackage{amssymb,amsmath}

\usepackage{fontspec} \usepackage{mypackage} \usepackage[czech]{babel}

\newfontfamily\ngg{Segoe UI Historic} \usepackage{enumitem}

\begin{document}

\underline{motto:}{ každý den $\pm$ nový princip }\hfill{$\square$} \ \ \begin{enumerate}[ label=\roman{enumi}--\arabic{enumi}--\large\ngg\symbol{\numexpr "13000+\value{enumi}}--]%\hgnum{\value{enumi}}] \item rozhodovat se na hraně zajímavého \item *vždycky to tam máš (data v matematice) K{\hg \hgunits{5}}L \item svoboda a volnost \item \hgnum{152123} \item \end{enumerate} \end{document}

mypackage.tex

% this is my first package
%
% (c) Buffalo Bill
%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%
\NeedsTeXFormat{LaTeX2e}[2994/06/01]
\ProvidesPackage{mypackage}
  [2011/01/11 v0.01 LaTeX package for my own purpose]

\usepackage{fontspec}

\usepackage{fontspec} \newfontfamily\hg{Segoe UI Historic}

\def\hgunits#1{\ifcase#1\relax\or ^^^^^^0133fa\or ^^^^^^0133fb\or ^^^^^^0133fc\or ^^^^^^0133fd\or ^^^^^^0133fe\or ^^^^^^0133ff\or ^^^^^^013400\or ^^^^^^013401\or ^^^^^^013402\else ?\fi}

\def\hgtens#1{\ifcase#1\relax\or ^^^^^^013386\or ^^^^^^013387\or ^^^^^^013388\or ^^^^^^013389\or ^^^^^^01338a\or ^^^^^^01338b\or ^^^^^^01348c\or ^^^^^^01348d\or ^^^^^^01348e\else ?\fi}

\def\hghundreds#1{\ifcase#1\relax\or ^^^^^^013362\or ^^^^^^013363\or ^^^^^^013364\or ^^^^^^013365\or ^^^^^^013366\or ^^^^^^013367\or ^^^^^^013368\or ^^^^^^013369\or ^^^^^^01336a\else ?\fi}

\def\hgthousands#1{\ifcase#1\relax\or ^^^^^^0131bc\or ^^^^^^0131bd\or ^^^^^^0131be\or ^^^^^^0131bf\or ^^^^^^0131c0\or ^^^^^^0131c1\or ^^^^^^0131c2\or ^^^^^^0131c3\or ^^^^^^0131c4\else ?\fi}

\def\hgtenthousands#1{\ifcase#1\relax\or ^^^^^^0130ad\or ^^^^^^0130ae\or ^^^^^^0130af\or ^^^^^^0130b0\or ^^^^^^0130b1\or ^^^^^^0130b2\or ^^^^^^0130b3\or ^^^^^^0130b4\or ^^^^^^0130b5\else ?\fi}

\def\hghundredthousands#1{\ifcase#1\relax\or ^^^^^^013190\or ^^^^^^013190^^^^^^013190\or ^^^^^^013190^^^^^^013190^^^^^^013190\or ^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190\or ^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190^^^^^^013190\else ?\fi}

\def\hgnum#1{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}} \def\hgnumx#1#2#3#4#5#6#7#8{% \hghundredthousands{#3}% \hgtenthousands{#4}% \hgthousands{#5}% \hghundreds{#6}% \hgtens{#7}% \hgunits{#8}% }

%\RequirePackage{whateverwe need} \def\hi{Hello, this is my own package} \let\myDate\date \newcommand\GoodBye[1][\bfseries]{{#1Good Bye}}

\endinput %% %% End of file `mypackage.sty'.

FHZ
  • 3,939
user2925716
  • 1,940

1 Answers1

2

enter image description here

declare \hgnum to be a robust command, change

\def\hgnum#1{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}}

to

\DeclareRobustCommand\hgnum[1]{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}}

Unrelated but you should delete the erroneous \\ which are generating bad output and the warnings:

Underfull \hbox (badness 10000) in paragraph at lines 19--22


Underfull \hbox (badness 10000) in paragraph at lines 19--22
Alan Munn
  • 218,180
David Carlisle
  • 757,742
  • It works fine now! Thank you! – user2925716 Oct 07 '19 at 19:57
  • It is inetersting that \! doesn't compile for you. For me it does: \begin{enumerate}[ label=\roman{enumi}--\arabic{enumi}--!!!!!\babyloniannum{\value{enumi}}!!!--\large\ngg\symbol{\numexpr "13000+\value{enumi}}--\hgnum{\value{enumi}}] – user2925716 Oct 07 '19 at 20:02
  • How do I achieve newline if I remove this: \\\ ? – user2925716 Oct 07 '19 at 20:05
  • enumerate starts a new display anyway https://tex.stackexchange.com/questions/334246/what-does-the-phrase-underfull-hbox-badness-10000-in-paragraph-actually-mea/334249#334249 – David Carlisle Oct 07 '19 at 20:10
  • on \! that is because now you have have provided a usable test file you are using amsmath which redefines \! the standard definition would give an error. – David Carlisle Oct 07 '19 at 20:13
  • But I need 2 newlines \\\ in a sequnece, starting enumerate gives one only. – user2925716 Oct 08 '19 at 14:47
  • Please, I'm trying hard to understand the number 10000000 in your \DeclareRobustCommand\hgnum[1]{{\hg\expandafter\hgnumx\the\numexpr10000000+#1\relax}} I've got familiar with \expandafter but that number is not clear to me yet. – user2925716 Oct 08 '19 at 14:49
  • @user2925716 imagine you want to pad a number to 4 digits but you might have 1 or 123 or 1234, simple way: add on 10000 then discard the leading 1 so 1->10001->0001, 123->10123->0123, 1234->11234->1234, this is same but forcing more digits – David Carlisle Oct 08 '19 at 15:02
  • Yes, I understand now. And what does \the there – user2925716 Oct 08 '19 at 15:05