2

A suggestion by @mico: The OP has specified that this table should be generated by MathJax, which is off-topic for this site. I propose, though, to re-open this posting, by making the question about how to generate this table using (pdf)LaTeX. This table has enough formatting-related aspects to make having one or more solutions of potential interest to future readers.

I made the following table:

enter image description here

As you can probably see, it is far too long... or wide or whatever.

$$\begin{array}
{|c|c|c|c|c|} \hline & \text{Equality} & eq(x,y): & \mathbb{R}\times\mathbb{R}\to\mathbb{B} & 1-|\operatorname{sgn}(x-y)| \\ 
\hline & \text{Digit At} & dat(x,b,i): & \mathbb{R}\times\mathbb{N}\times\mathbb{Z}\to\mathbb{N} & \left\lfloor\frac{|x|}{b^i}\right\rfloor\mod b \\ 
\hline & \text{Number of Digits} & nd(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \lceil\log_b(x+1)\rceil \\
\hline & \text{Reverse} & rev(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \sum_{i=0}^{nd(x,b)-1}dat(x,b,I)\cdot10^{nd(x,b)-i-1} \\ 
\hline & \text{Sum Digits} & sd(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \sum_{i=0}^{nd(x,b)-1}dat(x,b,i)\\ 
\hline & \text{Look and Say Counter} & C_\lambda(x,i): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & sd(x\mod10^i,10) \\
\hline & \text{Unpadded Difference} & \delta(x): & \mathbb{N}\to\mathbb{N} & \sum_{i=0}^{nd(x,10)-2}10^i\cdot(1-eq(dat(x,10,i),dat(x,10,i+1))) \\
\hline & \text{Padded Difference} & \Delta(x): & \mathbb{N}\to\mathbb{N} & 10^{nd(x,10)}+10\cdot\delta(x)+1 \\
\hline & \text{Leftmost Index} & il(x,i): & \mathbb{N}\times\mathbb{Z}\to\mathbb{Z} & nd(x\mod10^{i+1},10)-1 \\
\hline & \text{Rightmost Index} & ir(x,i): & \mathbb{N}\times\mathbb{Z}\to\mathbb{Z} & nd(x,10)-nd\left(rev\left(\left\lfloor\frac{x}{10^{i+1}}\right\rfloor,10\right),10\right) \\
\hline & \text{Look and Say} & L(x): & \mathbb{N}\to\mathbb{N} & \sum_{i=0}^{nd(\Delta(x),10)-2}\left(dat(\Delta(x),10,i)\cdot\left(\left(ir(\Delta(x),i)-i\right)\cdot10^{1+2\cdot C_\lambda(\Delta(x),i)}+dat(x,10,i)\cdot10^{2\cdot C_\lambda(\Delta(x),i)}\right)\right)
\end{array}$$

Can I make this fit better? Perhaps set a max width to each section and have it warp down when it hits that limiting size?

EDIT:

I have found that we can use /tiny or /small, but doing so reduces readability, which I would still like to have.

13
  • And how the preamble of document, by which we can test your table, is looking?
    – Zarko
    Commented Sep 1, 2016 at 22:58
  • @Zarko It is quite to long to the right and kind of floating behind the meta and related questions area. Commented Sep 1, 2016 at 23:00
  • 1
    This isn't LaTeX. I would split the table and add serial number in both tables. But I guess, you should have asked here
    – user1
    Commented Sep 1, 2016 at 23:17
  • 1
    @Ben Ok, thanks. Should I close this here then? Commented Sep 1, 2016 at 23:18
  • 1
    Thank you for your help and efforts, I have moved this question elsewhere: meta.math.stackexchange.com/questions/24924/… Or should I not have? Commented Sep 2, 2016 at 0:18

1 Answer 1

4

You can have your table fit the margins in landscape orientation:

    \documentclass{article}
\usepackage[utf8]{inputenc}%
 \usepackage[T1]{fontenc}
\usepackage[a4paper]{geometry}%
\usepackage{lscape}%

 \usepackage{mathtools, amsfonts}
\DeclareMathOperator{\sgn}{eq}
\DeclareMathOperator{\eq}{eq}
\DeclareMathOperator{\dat}{dat}
\DeclareMathOperator{\nd}{nd}
\DeclareMathOperator{\rev}{rev}
\DeclareMathOperator{\sd}{sd}
\DeclareMathOperator{\il}{il}
\DeclareMathOperator{\ir}{ir}
\DeclareMathOperator{\ls}{L}

\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\usepackage{makecell} %
\setcellgapes{5pt}

\begin{document}

\begin{landscape}
   \[ \makegapedcells\begin{array}
{|c|c|c|c|c|} \hline & \text{Equality} & \eq(x,y): & \mathbb{R}\times\mathbb{R}\to\mathbb{B} & 1-|\sgn(x-y)| \\
\hline %
& \text{Digit At} & \dat(x,b,i): & \mathbb{R}\times\mathbb{N}\times\mathbb{Z}\to\mathbb{N} & \floor*{\dfrac{\abs{x}}{b^i}}\mod b \\
\hline %
& \text{Number of Digits} & \nd(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \ceil{\log_b(x+1)} \\
\hline%
 & \text{Reverse} & \rev(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \displaystyle \smashoperator[r]{\sum_{i=0}^{\nd(x,b)-1}}\dat(x,b,I)\cdot10^{\nd(x,b)-i-1} \\
\hline%
 & \text{Sum Digits} & \sd(x,b): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \displaystyle\smashoperator[r]{\sum_{i=0}^{\nd(x,b)-1}}\dat(x,b,i)\\
\hline%
 & \text{Look and Say Counter} & C_\lambda(x,i): & \mathbb{N}\times\mathbb{N}\to\mathbb{N} & \sd(x\mod10^i,10) \\
\hline %
& \text{Unpadded Difference} & \delta(x): & \mathbb{N}\to\mathbb{N} & \displaystyle\smashoperator[r]{\sum_{i=0}^{\nd(x,10)-2}}10^i\cdot(1-\eq(\dat(x,10,i),\dat(x,10,i+1))) \\
\hline %
& \text{Padded Difference} & \Delta(x): & \mathbb{N}\to\mathbb{N} & 10^{\nd(x,10)}+10\cdot\delta(x)+1 \\
\hline%
 & \text{Leftmost Index} &\il(x,i): & \mathbb{N}\times\mathbb{Z}\to\mathbb{Z} & \nd(x\mod10^{i+1},10)-1 \\
\hline %
& \text{Rightmost Index} & \ir(x,i): & \mathbb{N}\times\mathbb{Z}\to\mathbb{Z} & \nd(x,10)-\nd\left(\rev\left(\floor{\dfrac{x}{10^{i+1}}},10\right),10\right) \\
\hline%
 & \text{Look and Say} & \ls(x): & \mathbb{N}\to\mathbb{N} & \begin{multlined}\smashoperator[r]{\sum_{i=0}^{\nd(\Delta(x),10)-2}}\dat(\Delta(x),10,i) \cdot\left(\left(\ir(\Delta(x),i)-i\right)\cdot10^{1+2\cdot C_\lambda(\Delta(x),i)}\right. \\[-4.5ex] \left.{}+\dat(x,10,i)\cdot10^{2\cdot C_\lambda(\Delta(x),i)}\right)
 \end{multlined}\\
 \hline
\end{array}
    \]
\end{landscape}

    \end{document} 

enter image description here

10
  • When I try to put this in math.SE, it says "unknown environment 'landscape'" Commented Sep 2, 2016 at 0:33
  • If you can post the actual code of the image with the special symbols around it and stuff instead of an image, I think I can figure out how to produce the same results. I hope. Commented Sep 2, 2016 at 0:37
  • 1
    ^^??? The code corresponds to the image. What do you mean?
    – Bernard
    Commented Sep 2, 2016 at 0:54
  • 1
    That makes them more difficult to read: they're italic and the spacing is not very good. As to the image, it's just a screenshot of the .pdf produced by the compilation. B.t.w. you can use \DeclareMathOperator on MathSE (but not a full preamble, as far as I know).
    – Bernard
    Commented Sep 2, 2016 at 1:09
  • 1
    @SimpleArt Have you tried OverLeaf or ShareLaTeX? It seems like that would be easier ....
    – cfr
    Commented Sep 2, 2016 at 1:20

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