3

I am using the tagging package in my document to "customize it. To include/exclude some parts of my document using a taglist, I could use the following : \begin{taggedblock}{<taglist>} and \end{taggedblock}. But I wanted to include this into a new environment (which is more complicated than the example which follows) so here is what I did :

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{tagging}

\newenvironment{myenvironment}[1]{\begin{taggedblock}{#1}}{\end{taggedblock}}

\usetag{1}

\begin{document}

\begin{myenvironment}{1,2}
test 1,2
\end{myenvironment}

\begin{myenvironment}{2}
test 2
\end{myenvironment}

\end{document}

But this example produces an error. From what I understand, the problem is this one : the way I defined myenvironment, it does not accept lists of tags. If I replace my second block with \begin{myenvironment}{1,2} test 2 \end{myenvironment} then there is no problem when I compile the document. How could I modify this environment to accept a list of tags ?

1 Answer 1

4

If you define your environment as

\newenvironment{myenvironment}[1]{\taggedblock{#1}}{\endtaggedblock}

then things work:

enter image description here

Note:

  • I have seen this trick used when wrapping environment around tabular but not sure why it is needed.

Code:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{tagging}

\newenvironment{myenvironment}[1]{\taggedblock{#1}}{\endtaggedblock}

\usetag{1}
%\droptag{2}

\begin{document}

\begin{myenvironment}{1,2}
test 1,2
\end{myenvironment}

\begin{myenvironment}{2}
test 2
\end{myenvironment}

\end{document}
2
  • Thanks a lot !! I can see there is a small difference between your definition of myenvironment and mine. I assume the problem was coming from the use of \begin and \end inside the definition of the environment (I was more or less nesting environments), right ?
    – pitchounet
    Commented Oct 9, 2014 at 18:04
  • @jibounet: Yep. And usually the way you were nesting them is ok. But sometimes it is not (like with tabular). Commented Oct 9, 2014 at 18:14

This site is temporarily in read-only mode and not accepting new answers.

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