0
% !TeX spellcheck = he_IL
\documentclass[titlepage=false,12pt,titlepage]{scrreprt}

%\pagenumbering{roman}

\usepackage{ucs}   %  unicode support
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
%-----
\usepackage{anyfontsize}
\usepackage{t1enc}

\usepackage[english,russian,hebrew]{babel}

\usepackage{helvet}
\renewcommand{\familydefault}{\rmdefault}



\usepackage[inline, shortlabels]{enumitem}

\renewcommand{\labelenumi}{)\textrm{\arabic{enumi}}(}
\renewcommand{\labelenumii}{\alph{enumii}(}


\setlist{topsep = 2 pt, partopsep = 1 pt, parsep = 0 pt, itemsep = 2 pt}



\usepackage{graphicx}
\usepackage{wasysym}




\newcommand{\mybigbox}{\APLbox}
\newcommand{\mybox}{\APLbox}
%------------------------------------------------------

\newcommand{\BoxArabicEnum}{)1( \APLbox}


\usepackage[left= 1cm, right= 1.5 cm, top=1cm,bottom=1 cm, footskip=0.5cm]{geometry}


\begin{document}

\L{First enumerate:}
\begin{enumerate}[ \BoxArabicEnum ]

\item  
a
\item
b
\item
c
\end{enumerate}

\L{Second enumerate:}

\begin{enumerate}[ )1( \APLbox ]

\item  
a
\item
b
\item
c
\end{enumerate}

\end{document}

%----------------------------------

And here is the result:

Result of compilation

Questions: Why "First enumerate:" is different from "Second enumerate:" and how to cause user-defined command \BoxArabicEnum to produce the same result as direct substitution )1( \APLbox ?

  • I can't compile your example due to hebrew, but the main culprit is that )1( isn't recognized as a format inside of an macro when using shortlabels as an enumitem. Since that package is sophisticated, it's not necessary to screw up the labelenumi etc. macros with \renewcommand statements, just use label=... – user31729 Nov 13 '15 at 19:37
  • Thank you, but this is not an answer, because I want to reproduce "\begin{enumerate}[ )1( \APLbox ]" with help of command \BoxArabicEnum only in certain places. – Rustam Nov 13 '15 at 19:50
  • It is an answer, but providing another solution ;-) – user31729 Nov 13 '15 at 19:52
  • You can use the label= each time you want to have or define a special enumerate list using newlist – user31729 Nov 13 '15 at 19:57
  • Sorry, but this is a bad solution, because in this case I should define several new enumerate lists. – Rustam Nov 13 '15 at 19:59
2

enumitem expects a key-value sequence and therefore doesn't expand the optional argument that is supplied. If you're sold on using this interface, you need to make sure that enumitem receives an expanded version of what you supply.

Below I've redefined enumerate to expands its optional argument. I've also opted to use a different way of printing \APLbox using an \fbox with invisible horizontal and vertical struts (zero-width \rules):

enter image description here

\documentclass{article}

\usepackage[inline, shortlabels]{enumitem}

\renewcommand{\labelenumi}{(\textrm{\arabic{enumi}})}
\renewcommand{\labelenumii}{\alph{enumii})}

\usepackage{wasysym,letltxmacro}

\newcommand{\mybigbox}{\APLbox}
\newcommand{\mybox}{\APLbox}

\setlength{\fboxsep}{0pt}
\newcommand{\BoxArabicEnum}{(1) \protect\fbox{\protect\rule{.55em}{0pt}\protect\rule{0pt}{.7em}}}
%\renewcommand{\BoxArabicEnum}{(1) \protect\APLbox}

\LetLtxMacro\oldenumerate\enumerate
\let\endoldenumerate\endenumerate
\makeatletter
\renewenvironment{enumerate}[1][]
  {\begingroup\protected@edef\x{\endgroup\noexpand\begin{oldenumerate}[#1]}\x}
  {\end{oldenumerate}}
\makeatother

\begin{document}

First enumerate:
\begin{enumerate}[ \BoxArabicEnum ]
  \item a
  \item b
  \item c
\end{enumerate}

Second enumerate:
\begin{enumerate}[ (1) \APLbox ]
  \item a
  \item b
  \item c
\end{enumerate}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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