add tag
निरंजन
I need to alternatively use package `linguex` and package `expex` for writing examples.

```
\documentclass{article}
\usepackage{linguex}
\usepackage{expex}

\begin{document}
	\ex. Hello world % Example with linguex
	
	\excnt=2 % Changing the expex-counter.
	\pex~ % Example with expex
	\a<a>\begingl
	\gla \rightcomment{[language]}An example//
	\glb The glossing//
	\glft Free translation//
	\endgl
	\xe
	\setcounter{ExNo}{3} % Changing the linguex-counter.
	\ex. Hello world % One more example with linguex
	
\end{document}
```

So what I don't want is to change the counters so many times. Can I have one common counter for both of them? Is there any way?
Top Answer
Skillmon
You could change the count register used by `ExNo` to be the same as `\excnt` uses by `\let`ting the underlying `\c@ExNo` to it. Unfortunately one has to still manually step the counter once, as it seems `\pex` doesn't step the counter at the beginning...

```tex
\documentclass{article}
\usepackage{linguex}
\usepackage{expex}

\makeatletter
\let\c@ExNo\excnt
\makeatother

\begin{document}
  \ex. Hello world % Example with linguex

  \stepcounter{ExNo}% still required as it seems it doesn't get stepped by \pex
  \pex~ % Example with expex
  \a<a>\begingl
  \gla \rightcomment{[language]}An example//
  \glb The glossing//
  \glft Free translation//
  \endgl
  \xe
  \ex. Hello world % One more example with linguex

\end{document}
```

**EDIT:** to tackle your question on what's the advantage. You can patch the counter-stepping into `\pex` using `etoolbox`:

```
\documentclass{article}
\usepackage{linguex}
\usepackage{expex}

\usepackage{etoolbox}
\pretocmd\pex{\stepcounter{ExNo}}{}{\GenericError{}{patching pex failed}{}{}}

\makeatletter
\let\c@ExNo\excnt
\makeatother

\begin{document}
  \ex. Hello world % Example with linguex

  \pex~ % Example with expex
  \a<a>\begingl
  \gla \rightcomment{[language]}An example//
  \glb The glossing//
  \glft Free translation//
  \endgl
  \xe
  \ex. Hello world % One more example with linguex

\end{document}
```

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.