5
$\begingroup$

$$\text{No. palindromes} = \begin{cases} {n \div 2 \choose (n-k) \div 2, k \div 2}, & n = 2x, k = 2y \\[2ex] {\lfloor n \div 2 \rfloor\choose (n-1 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y \\[2ex] {\lfloor n \div 2 \rfloor \choose (n-2 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y + 1 \\[2ex] 0, & n =2x, k = 2y +1 \end{cases}$$

I find that the clarity is somewhat reduced when certain expressions are put into piecewise functions, like ratios or as in my case, choose functions. Certain devices are quite small to begin with and/or don't allow user to zoom (or make zooming a messy task). Now, I saw there was a way to make the spacing between the expressions larger. Now, with that extra space, larger sizes for the expressions would have been possible. So, my question is, is it possible to enlarge expressions within piecewise functions, and if not, what would the issues be with such a feature?

$\endgroup$
5
  • 12
    $\begingroup$ As a hack, you can put in \displaystyle before each line in the cases. Not sure it will show up in a comment, but $$\text{No. palindromes} = \begin{cases} \displaystyle {n \div 2 \choose (n-k) \div 2, k \div 2}, & n = 2x, k = 2y \\[2ex] \displaystyle {\lfloor n \div 2 \rfloor\choose (n-1 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y \\[2ex] \displaystyle {\lfloor n \div 2 \rfloor \choose (n-2 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y + 1 \\[2ex] \displaystyle 0, & n =2x, k = 2y +1 \end{cases}\, .$$ As an aside, I would strongly recommend using / instead of \div. $\endgroup$ Sep 29 at 18:13
  • 3
    $\begingroup$ Thank you @ViktorVaughn, I think you should make this into an answer. Although Asaf Karagila's answer definitely gives a viable solution, one better than doing nothing, their solution does create a very big expression. Your solution hit the sweet spot in terms of size IMO. Also, why would you recommend using / instead of \div? $\endgroup$
    – user110391
    Sep 29 at 18:18
  • 9
    $\begingroup$ I suppose that using \dbinom for the binomial coefficients gives a similar (or maybe even the same) result as the solution suggested in the first comment: $$\text{No. palindromes} = \begin{cases} {\dbinom{n \div 2}{(n-k) \div 2, k \div 2}}, & n = 2x, k = 2y \\[2ex] {\dbinom{\lfloor n \div 2 \rfloor}{(n-1 -k) \div 2, k \div 2}}, & n = 2x +1, k = 2y \\[2ex] {\dbinom{\lfloor n \div 2 \rfloor}{(n-2 -k) \div 2, k \div 2}}, & n = 2x +1, k = 2y + 1 \\[2ex] 0, & n =2x, k = 2y +1 \end{cases}$$ $\endgroup$ Sep 29 at 21:01
  • $\begingroup$ @MartinSleziak, I think that \dbinom literally is \displaystyle\binom, as you suggest. $\endgroup$
    – LSpice
    Oct 2 at 1:50
  • 2
    $\begingroup$ @LSpice Yes, I believe so. The difference being that if the expression contains also some other stuff, that could be also influenced by including \displaystayle. Using \dbinom we're sure that we have only changed one particular binomial coefficient. $\endgroup$ Oct 2 at 2:24
14
$\begingroup$

This question might be a little off-topic for Math Meta—you are likely to get a better response from tex.se. However, since typesetting is often an issue on the main Math SE site, I suppose that this question is also in-scope here.

  1. Don't use \choose. The \choose command is a plain TeX command, and is not really appropriate for use in LaTeX. Instead, use the \binom command provided by the amsmath package: $\binom{n}{k}$ is typeset as $\binom{n}{k}$.

  2. Don't use \div (unless you are writing up a document for elementary school children. The obelus is almost never used in mathematical writing, except when teaching children. Because the obelus is uncommon, it is going to take most folk a minute to parse an expression which uses it. Moreover, it can be easily confused with a plus sign. Better to use a slash (i.e. $a/b$ is superior to $a\div b$).

  3. Use display style mathematics. This can be done by either explicitly using the \displaystyle command (in the cases environment, this needs to be done in each entry), or by using a few specific commands producing, e.g., display fractions or binomial terms—commands like \dfrac and \dbinom force display style mathematics, even in cases where it would normally not be displayed (note that there are inline equivalents: \textstyle, \tfrac, \tbinom, etc).

  4. Extra vertical space can be added between lines by adding a bit of stretch in square braces after the end-of-line. For example (as was done in the question above), \\[2ex] will add about two lowercase 'x'es of space between the current line and the next line. Personally, I think that [2ex] creates a little too much space, but that is largely a matter of style, and is between the author and their editor(s).

  5. As a matter of personal preference, I think that it is sometimes a good idea to put a little bit of extra space after a comma in math mode (particularly when the mathematics is behaving more like text than mathematics). There are various commands for adding space, e.g. \, or \ . I think that a little bit of extra space makes sense on the right-hand side of the cases environment (where the conditions are, essentially, text), and might help readability in the sort of generalized binomial coefficient notation being used here.

Using the above, the expression in the original question can be typeset as

 $$
 \text{no. palindromes} = \begin{cases}
      \dbinom{n/2}{(n-k)/2,\ k/2}, & n=2x,\, k=2y \\[1ex]
      \dbinom{\lfloor n/2 \rfloor}{(n-1-k)/2,\, k/2}, & n=2x+1,\ k=2y \\[1ex]
      \dbinom{\lfloor n/2 \rfloor}{(n-2-k)/2,\, k/2}, & n=2x+1,\ k=2y+1 \\[1ex]
      0, & n=2x,\ k=2y+1
 \end{cases}
 $$

which renders as

$$ \text{no. palindromes} = \begin{cases} \dbinom{n/2}{(n-k)/2,\ k/2}, & n=2x,\, k=2y \\[1ex] \dbinom{\lfloor n/2 \rfloor}{(n-1-k)/2,\, k/2}, & n=2x+1,\ k=2y \\[1ex] \dbinom{\lfloor n/2 \rfloor}{(n-2-k)/2,\, k/2}, & n=2x+1,\ k=2y+1 \\[1ex] 0, & n=2x,\ k=2y+1 \end{cases} $$

$\endgroup$
2
  • $\begingroup$ I've never seen obelus ($\div$) used in K-12 education in Poland, neither did I ever see the slash ($/$). Poles use the obelus with the slash taken out: just the colon ($:$) :) $\endgroup$ Oct 3 at 2:15
  • $\begingroup$ In MathJax (and not LaTeX) you can add more &s in your cases if you want to align the conditionals. But now I'm sidetracked, for some reason I am having mixed results with using \\[...] in comments. my variant: $$ A = \begin{cases} a, & b=0,& c=1 \[1ex] e, & fgh, & i=3 \[1ex] \end{cases} $$ yours: $$ A = \begin{cases} a, & b=0,\ c=1 \[1ex] e, & fgh, \ i=3 \[1ex] \end{cases} $$ and without the [...]: $$ A = \begin{cases} a, & b=0,& c=1 \\ e, & fgh, & i=3 \\ \end{cases} $$ $\endgroup$ Oct 3 at 7:24
1
$\begingroup$

You can use dcases from mathtools, although I don't know how it works since I tried using the require command and it didn't work. You can find the package and the environment here. For $\rm\LaTeX$ though, it makes the subfunctions render in a displayed style.

$\endgroup$
1
  • 2
    $\begingroup$ I think I have the explanation for this. The first problem is that \require fails silently when you load a non-existent package: \require{bla}abc just produces $\require{bla}abc$, unlike when you use a bad command e.g. $\bad$. The second problem is that mathtools only appears in the docs for the latest build of MathJax, in particular for MathJax 3, and not in the docs for 2.7.x which is what Math.SE uses. $\endgroup$ Oct 3 at 7:02
0
$\begingroup$

Add \Large in front of the whole thing:

$$\Large\text{No. palindromes} = \begin{cases} {n \div 2 \choose (n-k) \div 2, k \div 2}, & n = 2x, k = 2y \\[2ex] {\lfloor n \div 2 \rfloor\choose (n-1 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y \\[2ex] {\lfloor n \div 2 \rfloor \choose (n-2 -k) \div 2, k \div 2}, & n = 2x +1, k = 2y + 1 \\[2ex] 0, & n =2x, k = 2y +1 \end{cases}$$

$\endgroup$
1
  • 8
    $\begingroup$ Eek, aside from the fact that putting the \Large too early makes "No. palindromes" also \Large, I think the parentheses around the binomial coefficients strongly suggest that this is not an ideal solution! $\endgroup$
    – LSpice
    Oct 2 at 1:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .