add tag
JeT
This [answer](https://topanswers.xyz/tex?q=1906) showed me how to hide some elements in `itemize`.

I try to organize my code and I created `myenvironment.sty`.

```
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{myenvironment}
[2022/06/02 v1.00 Centralisation des nouveaux environnements]

\newenvironment{hideBitem}{%
\begin{itemize}[<beamer:only@0>]}%
{\end{itemize} }

\endinput
```

Strangely enough, I get 2 different renderings whether I input the `hideBitem` directly in the preambule or in the `myenvironment.sty`.

1 - With the new environment directly in the preambule
![case2.png](/image?hash=bbbffd9c2f4e9d110c9129ec0ae54fe3b7cf3532c288679f7be69caee407889c)

2 - The new environment is called via a `.sty`
![case3.png](/image?hash=458e47878eea7344df2eae4fec80055c4c68d7d06142ef45d9ab492c84393868)

MWE

```
\begin{filecontents*}[overwrite]{myenvironment.sty}
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{myenvironment}
[2022/06/02 v1.00 Centralisation des nouveaux environnements]

\newenvironment{hideBitem}{%
\begin{itemize}[<beamer:only@0>]}%
{\end{itemize} }

\endinput

\end{filecontents*}


\documentclass{beamer}
\usepackage{myenvironment} %

%\newenvironment{hideBitem}{
%\begin{itemize}[<beamer:only@0>]}{%
%\end{itemize} }

\newcommand{\boldflatitem}{%
	\mode<article>{
		\setlist[enumerate,1]{%
			label = \textcolor{red}{\arabic*.},
			font  = \bfseries,
			before = \bfseries
		}
		\setlist[itemize,1]{%
			font = \normalfont,
			before = \normalfont,
		}
	}
		
	\mode<beamer>{
		\setbeamerfont{itemize/enumerate body}{series=\bfseries}
		\setbeamerfont{itemize/enumerate subbody}{series=\normalfont}
	}
			
}

\begin{document}

\begin{frame}{boldflatitem + enumerate/hideBitem}
	\boldflatitem{}	
	\begin{enumerate}
		\item level 1
		      \begin{hideBitem}
		      	\item level 2
		      	\begin{enumerate}
		      		\item level 3
		      		\item level 3
		      	\end{enumerate}
		      	\item level 2
		      \end{hideBitem}	
		\item level 1
		      \begin{hideBitem}
		      	\item level 2
		      	\item level 2
		      \end{hideBitem}	
	\end{enumerate}
\end{frame}    


\end{document} 
```
Top Answer
frougon
In a LaTeX document, the normal category code for `@` is 12 (“other”), whereas when LaTeX reads a .sty file, it does so with a modified category code régime, where `@` has category code 11 (“letter”). This is so that control sequence tokens containing `@` characters can naturally be used in .sty files.

In your case, the `beamer` machinery apparently expects the `@` to be input with category code 12, so you simply need to change the category code of `@` to 12 (what `\makeatother` does) before your environment definition in the .sty. It's also good practice to restore it to 11 afterwards (e.g., using `\makeatletter`) in case you later add more code to the .sty file.

```
% In the .sty file
\makeatother
\newenvironment{hideBitem}%
  {\begin{itemize}[<beamer:only@0>]}%
  {\end{itemize}}
\makeatletter
```

Beware of spurious spaces in your input. There was one after `\end{itemize}`, which probably doesn't harm here... but as inline redefinitions of list environments are possible (cf. `enumitem`), I prefer not to put any extraneous space, just in case.

Note that this is given as general advice: as samcarter [wrote](https://topanswers.xyz/transcript?room=2067&id=140527#c140527), the `beamer` class is incompatible with the `enumitem` package.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.