tasks icon indicating copy to clipboard operation
tasks copied to clipboard

An other enviroment in tasks messes with spaces

Open Sk1nk opened this issue 4 years ago • 6 comments

Having an environment like align* or even your own blank in a separate line of the task, the next task moves away an additional line.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xsim}
\usepackage{tasks}
\begin{document}
	\begin{tasks}
	\task normal Space after that
	\task HUGE gap after  \begin{align*}
		3
	\end{align*}	
	\task works fine with blank in line \blank{a}
	\task filler
	\task messes with blank in separate line
	
	\blank{line}
	\task filler
	\end{tasks}
\end{document}

Sk1nk avatar Mar 18 '20 08:03 Sk1nk

Turning the debug mode on I don't see anything unexpected to be honest:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xsim}
\usepackage{tasks}
\settasks{debug}
\begin{document}

\begin{tasks}
  \task normal Space after that
  \task HUGE gap after
    \begin{align*}
     3
    \end{align*}
  \task works fine with blank in line \blank{a}
  \task filler
  \task messes with blank in separate line

  \blank{line}
  \task filler
\end{tasks}

\end{document}

image

Maybe you want to adapt the spacing around display math? See here for example: https://tex.stackexchange.com/q/69662/

cgnieder avatar Mar 18 '20 18:03 cgnieder

@cgnieder to me it looks as if there is an extra empty line after the display containing the "3". You can prove that to yourself simply by doing \newpage repeat the task env and add "a line of text" after the \end{align*}. Then nothing changes from page 1 to 2 only that text appears in the place instead of the empty line

FrankMittelbach avatar Mar 18 '20 18:03 FrankMittelbach

@FrankMittelbach I must admit that I haven't looked closely, yet...

cgnieder avatar Mar 18 '20 19:03 cgnieder

always easier to look at it from the outside :-) Clemens

FrankMittelbach avatar Mar 18 '20 20:03 FrankMittelbach

The issue seems to be the strut in

\vcoffin_set:Nnn \l__tasks_tmpa_coffin
  { \l__tasks_item_width_dim }
  { \__tasks_setup: #2 {#3} \mode_if_horizontal:T { \strut } }

cgnieder avatar Mar 19 '20 18:03 cgnieder

For the time being I suggest the following usage: if the display math is the last object in an item add a \par at the end to be sure to leave the horizontal mode. And in the example the starred \blank*{line} seems to be the better choice:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xsim}
\usepackage{tasks}
\settasks{debug}
\begin{document}

\begin{tasks}
  \task normal Space after that
  \task HUGE gap after
    \begin{align*}
      3
    \end{align*}\par
  \task works fine with blank in line \blank{a}
  \task filler
  \task messes with blank in separate line

  \blank*{line}
  \task filler
\end{tasks}

\end{document}

image

cgnieder avatar Mar 21 '20 08:03 cgnieder