SpectralSequences / latex

Latex package to print spectral sequence diagrams using pgf/tikz.
9 stars 4 forks source link

Axis labelling #19

Closed drewheard closed 2 years ago

drewheard commented 2 years ago

Not sure if it is an issue as such, but is there a way to "fake" the label axis, to have something like Example 5.5 of https://pi.math.cornell.edu/~hatcher/AT/ATch5.pdf?

hoodmane commented 2 years ago

One way is to use the y tick handler key. The following seems to look pretty good. It doesn't seem to get the spacing of the labels correct by default so I put an extra \quad of spacing to the right.

\begin{sseqpage}[
  y tick handler = {
    \ifnum#1 = 0\relax
      0%
    \else
      \ifnum#1>1\relax#1\fi n - #1%
      % labels too close to axis by default 
      % so insert a bit of extra space
      \quad 
    \fi
  }
]
\class(0,0)
\class(4,4)
\end{sseqpage}

As another approach, the manual gives the following example:

\begin{sseqpage}[ no x ticks, x range = {0}{3} ]
\begin{scope}[ background ]
  \node at (0,\ymin - 1) {0};
  \node at (1,\ymin - 1) {n};
\foreach \n in {2,..., \xmax}{
  \node at (\n,\ymin - 1) {\n n};
}
\end{scope}
\class(0,0)
\class(3,2)
\end{sseqpage}

which could be adapted to your use case. This would probably be the way to go if the labels are particularly complicated.

drewheard commented 2 years ago

Thanks Hood! FYI, the manual at https://ctan.uib.no/graphics/pgf/contrib/spectralsequences/manual/spectralsequencesmanual.pdf is shorter than it should be, I believe (in particular, the example you gave doesn't appear)

drewheard commented 2 years ago

OK, the code

\begin{sseqpage}[no x ticks,no y ticks, classes = {draw = none},homological Serre grading]
\begin{scope}[ background ]
  \node at (0,-1) {0};
  \node at (3,-1) {n};
  \node at (-1,0) {0};
  \node at (-1,2) {n-1\quad};
  \node at (-1,4) {2n-2 \quad};
    \node at (-1,6) {3n-3\quad};
  \end{scope}
\class["\mathbb{Z}"](0,0)
\class["\mathbb{Z}"](3,0)
\class["H_{n-1}(\Omega S^n)"](0,2)
\class["H_{n-1}(\Omega S^n)"](3,2)
\class["H_{2n-2)}(\Omega S^n)"](0,4)
\class["H_{2n-2)}(\Omega S^n)"](3,4)
\class["H_{3n-3)}(\Omega S^n)"](0,6)
\class["H_{3n-3)}(\Omega S^n)"](3,6)
\d3(3,0)
\d3(3,2)
\d3(3,4)
\end{sseqpage}

works almost perfectly, except for the clipping. Any easy way to fix that?

hoodmane commented 2 years ago

I think y axis gap=1.5cm, x axis extend end=1cm looks about right. You may also want right clip padding. The following diagram which should appear at the end of the manual explains the various parameters to adjust the chart display: Screenshot from 2022-08-09 15-58-42

drewheard commented 2 years ago

Looks fantastic. Thanks again (and for the great package!)

hoodmane commented 2 years ago

the manual is shorter than it should be

Thanks for pointing that out. I guess I should release a new version with the manual fixed...