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.)


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


1   &   \text{if } y > 0 \\
-1  &   \text{if } y < 0


closed as unclear what you're asking by Andrew Swann, Schweinebacke, Henri Menke, Stefan Pinnow, Raaja Apr 25 at 11:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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