This is my code.
xxxxxxxxxx
\documentclass{article}
\usepackage{multicol}
\usepackage{linguex}
\usepackage{tikz}
\begin{document}
\begin{multicols}{2}
\ex. Two ways of forming a triangle.\\
\a.\begin{tikzpicture}
\draw (0,0) -- (-1.5,-3) -- (1.5,-3) -- cycle;
\end{tikzpicture}\\
\columnbreak
\b.\begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
\end{tikzpicture}\\
\end{multicols}
\end{document}
It generates -
I want the ex.
to be out of the multicols
environment, because in the output the example b.
, because I want both a.
and b.
to be on the same height. How to achieve it?
PS - I tried \phantom{\ex.}
but it doesn’t work.
I suggest to use the enumitem
package to place multiple subitems in a single line. You don’t need to be worried about suspending and restarting the linguex counter because you could just place the the additional enumerate
environment between your \ex.
ones.
xxxxxxxxxx
\documentclass{article}
\usepackage{multicol}
\usepackage{linguex}
\usepackage{tikz}
\usepackage[inline]{enumitem}
\begin{document}
\ex. Two something
\a. foo
\b. bar
\begin{enumerate}[label={(\arabic*)},labelsep=\Exlabelsep\relax,labelwidth=\Exlabelwidth]
\setcounter{enumi}{\value{ExNo}}
\item \hspace{0.6em}Two ways of forming a triangle.
\begin{enumerate*}[label={\hspace{-0.9em}\alph*.}]
\item
\begin{tikzpicture}
\draw (0,0) -- (-1.5,-3) -- (1.5,-3) -- cycle;
\end{tikzpicture}
\hspace*{\fill}
\item
\begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
\end{tikzpicture}
\end{enumerate*}
\end{enumerate}
\stepcounter{ExNo}
\ex. Two something
\a. foo
\b. bar
\end{document}
If there are only two or three items then simply write the a.
, b.
, … by yourself without the commands:
xxxxxxxxxx
\documentclass{article}
\usepackage{linguex}
\usepackage{tikz}
\begin{document}
\ex. Two ways of forming a triangle.\\
a. \begin{tikzpicture}
\draw (0,0) -- (-1.5,-3) -- (1.5,-3) -- cycle;
\end{tikzpicture}
\qquad
b. \begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
\end{tikzpicture}
\end{document}
You don’t need to worry about setting and resetting counters, tex can do this for you
The solution looks cool, but I still wish that this issue gets resolved in the limits of the package itself. Let’s imagine that the ex.
is fourth or fifth in the chronology. Then I’ll have to set and reset the counter twice (which I don’t want to) In fact that is the sole purpose of this package. Can we tweak something in the preamble for such special cases when an environment comes in between the examples?
xxxxxxxxxx
\documentclass{article}
\usepackage{multicol}
\usepackage{linguex}
\usepackage{tikz}
\usepackage[inline]{enumitem}
\begin{document}
\begin{enumerate}[label=(\arabic*)]
\item Two ways of forming a triangle.
\begin{enumerate*}[label=\alph*.]
\item
\begin{tikzpicture}
\draw (0,0) -- (-1.5,-3) -- (1.5,-3) -- cycle;
\end{tikzpicture}
\hspace*{\fill}
\item
\begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
\end{tikzpicture}
\end{enumerate*}
\item Two ways of forming a triangle.
\begin{enumerate*}[label=\alph*.]
\item
\begin{tikzpicture}
\draw (0,0) -- (-1.5,-3) -- (1.5,-3) -- cycle;
\end{tikzpicture}
\hspace*{\fill}
\item
\begin{tikzpicture}
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
\end{tikzpicture}
\end{enumerate*}
\end{enumerate}
\end{document}