3

I want to typeset a piecewise function - a function defined on two "pieces" of the domain. The pdf file I get when compiling the following code seems to have four lines, the first and third of which are blank. It makes for an ugly display.

I have used the cases environment hundreds of times. This is the first time it is not being displayed properly. (On another computer - a Macintosh - the same code gives the expected display.)

\documentclass[10pt]{amsart}
\usepackage{amsmath}
\usepackage{mathtools,array}


%\usepackage[nodisplayskipstretch]{setspace} %suggested by egreg
%\setstretch{2.0}                            %suggested by egreg
%\everydisplay{\setstretch{1.0}}             %suggested by egreg


\begin{document}


\begin{equation*}
\begin{cases}
1   &   \text{if } y > 0 \\
-1  &   \text{if } y < 0
\end{cases}
\end{equation*}


\end{document}
  • 2
    What are the "four spaces" you are referring to? At the whole document? Try to delete new lines in the code i.e. delete the two lines around the equation* environment and then re-compile. – manooooh Feb 1 at 3:06
  • 1
    The display I get to the right of the brace is a blank line, "1 if y > 0" in the second line, a blank line, and "-1 if y < 0" in the fourth line. – A gal named Desire Feb 1 at 3:13
  • 4
    Have you a \renewcommand{\arraystretch}{...} somewhere in your actual code? (Off-topic: mathtools already loads amsmath no need to load it) – CarLaTeX Feb 1 at 4:06
  • Off-topic: The amsmath package is loaded automatically by the amsart document class -- no need to load it again. – Mico Feb 1 at 5:45
  • You should test your MWE so it produces output that shows your issue. This MWE doesn't (output, click here). The problem you face is most likely caused by changing the interline spacing, possibly with the setspace package. In this case, the question is a duplicate of tex.stackexchange.com/questions/472508/… – egreg Feb 1 at 8:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.