Personally I don't like this kind of repetition, although it is used by some. I think it's preferable to repeat the example with a new number. But independent of this opinion, the effect is easily achieved with both the gb4e
package and the linguex
package.
gb4e
It provides an \exr{<label>}
command, which formats the example based on reference to a label.
\documentclass{article}
\usepackage{gb4e}
\newcommand\extwo{Example 2}
\begin{document}
\begin{exe}
\ex Example 1
\ex \extwo \label{ex2}
\end{exe}
Text
\begin{exe}
\ex Example 3
\end{exe}
Text
\begin{exe}
\exr{ex2} \extwo% Example 2 repeated with its original number, i.e. "1."
\end{exe}
Text
\begin{exe}
\item Example 4% Is listed as "3." when I want it be listed as "4."
\end{exe}
\end{document}
linguex
It allows its \ex.
command to have an following optional argument to set the label. This argument can contain a \ref{}
command.
\documentclass{article}
\usepackage{linguex}
\newcommand\extwo{Example 2}
\begin{document}
\ex. Example 1
\ex. \extwo \label{ex2}
Text.
\ex. Example 3
Text.
\ex.[\ref{ex2}] \extwo
Text
\ex. Example 4
\end{document}
Your problem is that you need to change the values of different penaltys to 10000
(not allowed).
The easierst way to do that is to patch the relevant commands with package etoolbox
and the command \patchcmd{\command-to-be-patched}{search-code}{replace-code}{sucess}{failure}
(please see the comments!):
\usepackage{etoolbox} % <============================ to patch penaltys
\patchcmd{\thebibliography}{\clubpenalty4000}{\clubpenalty10000}{}{} % no orphans
\patchcmd{\thebibliography}{\widowpenalty4000}{\widowpenalty10000}{}{} % no widows
\patchcmd{\bibsetup}{\interlinepenalty=5000}{\interlinepenalty=10000}{}{} % no break of entry
So with this complete MWE
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{DoeA,
title={The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog},
author={Doe, John and Bar, Foo and Bob, Joe and Kid, Billy The and Lucky, Luke and Kong, King},
journal={Journal A of supposed excellence and uncomfortably long titles to make this example work. },
year={2001},
}
@article{DoeB,
title={The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog},
author={Doe, John and Bar, Foo and Bob, Joe and Kid, Billy The and Lucky, Luke and Kong, King},
journal={Journal B of supposed excellence and uncomfortably long titles to make this example work. },
year={2001}
}
@article{DoeC,
title={The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog},
author={Doe, John and Bar, Foo and Bob, Joe and Kid, Billy The and Lucky, Luke and Kong, King},
journal={Journal C of supposed excellence and uncomfortably long titles to make this example work. },
year={2001},
}
@article{Genius02,
title={Title B},
author={Genius, Evil and Vader, Darth},
journal={Journal B},
year={2002},
}
\end{filecontents}
\documentclass[10pt]{article}
\usepackage{multicol}
\usepackage[left=2.1cm,right=1.4cm,top=23.5cm,bottom=2cm]{geometry}
\usepackage[backend=bibtex]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{showframe} % <========================= to show typing area!
\usepackage{etoolbox} % <============================ to patch penaltys
\patchcmd{\thebibliography}{\clubpenalty4000}{\clubpenalty10000}{}{} % no orphans
\patchcmd{\thebibliography}{\widowpenalty4000}{\widowpenalty10000}{}{} % no widows
\patchcmd{\bibsetup}{\interlinepenalty=5000}{\interlinepenalty=10000}{}{} % no break of entry
\begin{document}
\begin{multicols}{2}
\nocite{DoeA,DoeB,DoeC,Genius02}
\printbibliography
\end{multicols}
\end{document}
you get the following result (I used package showframe
to visualise the resulting typing area):
Best Answer
To ensure that an entire
\item
's text is on the same page (assuming of course that it will fit on the page), you can adapt the solution I used to Replace \item with \MyItem to box each list member with an mdframed, to instead place each\item
within aminipage
.Here is a normal
enumerate
environment where item (c) is split across a page:and using the
MyEnumerate
environment we get item (c) on a new page since it does not fit on the previous page.Notes:
An
\addvspace{\baselineskip}
has been added in between theminipage
to resolve the issue with vertical spacing issue that was in an earlier version.The
geometry
package was used only to adjust the paper height to show that theMyEnumerate
actually moves the list member to a new page if it does not fit.Code: