• No results found

1Preface TableofContents v1.3a2021/02/20 tasks

N/A
N/A
Protected

Academic year: 2021

Share "1Preface TableofContents v1.3a2021/02/20 tasks"

Copied!
16
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

tasks

v1.3a

2021/02/20

lists with columns filled horizontally Clemens Niederberger https://github.com/cgnieder/tasks/

contact@mychemistry.eu

Table of Contents

1 Preface 1

1.1 Motivation & History . . . 1 1.2 Changes . . . 2

2 License and Requirements 2

3 How it works 2

3.1 Background . . . 2 3.2 The Basics . . . 3 3.3 Items Spanning More Than

One Column . . . 4

4 Available Options 8

5 Available Instances 12

6 Custom Labels 12

7 Newtasks-like Environments 13

8 Stylingta s k s 14

8.1 ThetasksObject . . . . 14 8.1.1 Available Options . . . 14 8.1.2 Predefined Instances . 15

9 References 16

10 Index 16

1

Preface

1.1 Motivation & History

Originallytaskshas been an integral part of theExSheets updated in v0.7

(2013/01/19)

package [Nie19]. However, users told me that it indeed could be useful to have it as a stand-alone package not having to load the wholeExSheetsbeast just for having thetasksenvironment available. Since I agree with

this the environment has been extracted into a package if its own,tasks. Since thentasks has been distributed as a package of its own but as part of theExSheetsbundle

updated in v0.10

(2014/07/20)

. With v0.10 I decided to make it a completely independent package. So the relation toExSheetsonly is a historical one.

The reason for thetasksenvironment is an unwritten agreement in German maths textbooks

(2)

2 License and Requirements

you’re better off using traditional LATEX lists and the enumitem package for customization. 1.2 Changes

The introduced

in v1.0 (2019/10/04)

step to version 1.0 brought some significant changes:

• the optioncounter-formatis deprecated. Labels can now be set quite similar to the

way they are set in enumitem. This also made theenumerateoption of the list template

superfluous which has been removed accordingly.

• The commands\NewTasksand\RenewTaskshave been renamed. • The multiple choice lists have been removed.

• Custom definitions can be put in atasks.cfgfile which is automatically loaded if

avail-able.

2

License and Requirements

Permission is granted to copy, distribute and/or modify this software under the terms of the LATEX Project Public License (lppl), version 1.3c or later (http://www.latex-project.org/ lppl.txt). The software has the status “maintained.”

tasksrequires the l3kernel [L3P] bundle, xparse1and xtemplate.

3

How it works

3.1 Background

Thetasksenvironment is similar to a list likeenumeratebut not the same. Here are some of

the differences:

there is no pagebreak possible inside an item but only between items. 1.

the enumeration default is a), b), c) . . . 2.

the body of thetasksenvironment is split at every occurrence of the item separator. For

this reason the default separator is not\itembut\taskso it is unique to this environment only. This directly leads to. . .

3.

. . . the fact that the tasksenvironment cannot be nested. You can, however, use an

itemizeenvironment or another “real” list in it.

4.

A fifth difference: verbatim material cannot be used in it. You’ll have to use\string, \textttor\detokenize. If this won’t suffice then don’t usetasks.

5.

(3)

3 How it works

!

The environments oftasksare what I like to call “pseudo-environments”. This means like environments defined by the package environ [Rob14] the body of the environment is read as argument before it is processed. This is why verbatim material cannot be used intasks’ lists.

3.2 The Basics

\begin{tasks}[hoptionsi](hnum of columnsi)

List like environment where the single items are introduced with\task. Let’s see an example:

1 % \Sample is defined to contain some sample text:

2 % \def\sample{This is some sample text we will use to create a somewhat 3 % longer text spanning a few lines.}

4 % \def\Sample{\sample\ \sample\par\sample} 5 Some text before the list.

6 \begin{tasks} 7 \task \Sample 8 \task \Sample 9 \task \Sample 10 \end{tasks}

11 And also some text after it.

Some text before the list.

This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines.

This is some sample text we will use to create a somewhat longer text spanning a few lines.

a)

This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines.

This is some sample text we will use to create a somewhat longer text spanning a few lines.

b)

This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines.

This is some sample text we will use to create a somewhat longer text spanning a few lines.

c)

(4)

3 How it works

The environment takes the optional argument(hnum of columnsi)with which the number of columns used by the environment is specified.

1 \begin{tasks}(2) 2 \task \Sample

3 \task \sample\ \sample 4 \task \sample

5 \task \Sample

6 \task \sample\par\sample 7 \end{tasks}

This is some sample text we will use to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

a) This is some sample text we will use

to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. b)

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

c) This is some sample text we will use

to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

d)

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

e)

3.3 Items Spanning More Than One Column

Sometimes it may come in handy if an item is allowed to span more than one column.tasks introduced in

v0.10

(5)

3 How it works 1 \begin{tasks}(3) 2 \task \sample 3 \task* \sample 4 \task* \sample 5 \task \sample 6 \task \sample 7 \end{tasks}

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

a) This is some sample text we will use to create a some-what longer text spanning a few lines.

b)

This is some sample text we will use to create a somewhat longer text spanning a few lines.

c)

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

d) This is some sample

text we will use to cre-ate a somewhat longer text spanning a few lines.

e)

tasks introduced in

v0.10

also supports items that span all columns in any case by adding an optional bang to

\task. 1 \begin{tasks}(3) 2 \task \sample 3 \task! \sample 4 \task! \sample 5 \task \sample 6 \task \sample 7 \end{tasks}

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

a)

This is some sample text we will use to create a somewhat longer text spanning a few lines.

(6)

3 How it works

This is some sample text we will use to create a somewhat longer text spanning a few lines.

c)

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

d) This is some sample

text we will use to cre-ate a somewhat longer text spanning a few lines.

e)

The optional star has itself an optional argument with parentheses where you can specify the number of columns the item is supposed to span:

1 \settasks{debug} 2 \begin{tasks}(4) 3 \task the first 4 \task the second 5 \task the third 6 \task the fourth

7 \task*(3) the fifth item is way too long for this and needs three columns

8 \task the sixth 9 \task the seventh

10 \task*(2) the eighth item is way too long for this and needs two columns

11 \task the nineth 12 \task the tenth 13 \end{tasks}

the first

a) b) the second c) the third d) the fourth

the fifth item is way too long for this and needs three columns

e) f) the sixth

the seventh

g) the eighth item is way too long for this and needs two columns

h) i) the nineth

the tenth j)

If there are not enough columns left (say two columns but you said\task*(3)) the argument

is ignored and the maximum number of remaining columns is used (two in case of our example). Both optional star and optional bang can be combined with the optional argument for a custom label:

(7)

3 How it works 3 \task* \sample 4 \task*[(x)] \sample 5 \task \sample 6 \task \sample 7 \end{tasks}

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

a) This is some sample text we will use to create a some-what longer text spanning a few lines.

b)

This is some sample text we will use to create a somewhat longer text spanning a few lines.

(x)

This is some sample text we will use to cre-ate a somewhat longer text spanning a few lines.

c) This is some sample

text we will use to cre-ate a somewhat longer text spanning a few lines.

d)

Forcing a new item line manually is also possible introduced

in v0.9 (2013/04/07)

using the following command:

\startnewitemline

Introduce a new line in atasksenvironment.

While this works it also needs a bit of care since the width of the items doesn’t change which means in order to use the full width you’d have to use trickery like\rlapwhich then means the danger of the item text sticking into the margin.

1 \begin{tasks}(4) 2 \task the first 3 \task the second 4 \task the third 5 \task the fourth

6 \task \rlap{the fifth item is way too long for this so we start a new row} 7 \startnewitemline

8 \task the sixth 9 \task the seventh

10 \task \rlap{the eighth item also is too long} \startnewitemline 11 \task the nineth

12 \task the tenth

(8)

4 Available Options

the first

a) b) the second c) the third d) the fourth

the fifth item is way too long for this so we start a new row e)

the sixth

f) g) the seventh h) the eighth item also is too long the nineth

i) j) the tenth

4

Available Options

Thetaskspackage does not have any package options updated in

v0.10

.

The environmenttaskshas a number of options, though, namely the following ones that

can be set using a setup command:

\settasks{hoptionsi}

Setup command fortasks.

style= {hinstancei} (initially empty) Choose the instance to be used. Read more on this in section8.1.

label-format= {hcodei} (initially empty)

updated

in v1.1a (2020/01/11)

Can be used to apply a formatting like, e. g.,\bfseriesto the labels. This may be code accepting the item as mandatory argument.

label= {hcodei} Default:\alph*)

updated in v1.0 Sets a custom label. The*is replaced by{task}. This is heavily inspired by enumitem’s [Bez19]

labeloption.

ref= {hcodei} (initially empty)

introduced

in v1.3 (2020/08/19)

Works likelabelbut sets the output of the reference by setting\thehcounteri(\thetaskin the default setting).

label-width= {hdimi} Default:1em

Sets the width of the item labels.

label-offset= {hdimi} Default:.3333em

introduced in

v0.7

Sets the offset, i. e., the distance between label and item.

item-format= {hcodei} (initially empty)

introduced in v0.11

(2016/05/03)

Can be used to apply a formatting like, e. g.,\bfseriesto the items. This may be code accepting the item as mandatory argument.

item-indent= {hdimi} Default:2.5em

introduced in v0.9a

(2013/04/22)

The indent of an item, i. e., the horizontal space available for both label and label-offset. If

(9)

4 Available Options

column sep

item indent item width

label width label offset

F i g u r e 1 : A visual representation of the used lengths.

the label will align with the textblock above (iflabel-align= {left}is set). Please see figure1

for a sketch of the available lengths and how they are set.

column-sep= {hdimi} Default:0pt

introduced in v0.10

A horizontal length that is inserted between columns ot items.

label-align= left|right|center Default:left

introduced in v0.7

Determines how the labels are aligned within the label-box whose width is set withlabel-width.

before-skip= {hskipi} Default:0pt

Sets the skip before the list.

after-skip= {hskipi} Default:0pt

Sets the skip after the list.

after-item-skip= {hskipi} Default:1ex plus 1ex minus 1ex

introduced in

v0.9

This vertical skip is inserted between rows of items.

resume= true|false Default:false

The enumeration will resume from a previoustasksenvironment. In order to use this option

properly you shouldn’t mix differenttasksenvironments that both count their items.

start= {hintegeri} Default:1

introduced in v1.1 (2019/11/03)

Set the starting value with which the list starts counting.

counter= {hcounteri} Default:task

introduced in v1.2 (2020/03/21)

The counter to be used to count the items.

debug= true|false Default:false

introduced in v0.10

If set to true\fboxsepis set to0ptinside thetasksenvironment and\fboxis used to draw a frame around the label boxes and the item boxes.

Now the same list as above but with three columns and a different label:

1 \begin{tasks}[label=(\roman*),label-width=4ex](2)

2 \task \Sample

(10)

4 Available Options

5 \task \Sample

6 \task \sample\par\sample

7 \end{tasks}

This is some sample text we will use to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

(i) This is some sample text we will use

to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. (ii)

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

(iii) This is some sample text we will use

to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

(iv)

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

This is some sample text we will use to create a somewhat longer text span-ning a few lines.

(v)

Let’s use it inside a question, i. e., inside xsim’sexerciseenvironment [Nie20]:

1 % since settings are local the following ones will be lost 2 % outside this example;

3 \settasks{

4 label = \theexercise.\arabic* ,

5 item-indent = 2em , 6 label-width = 2em , 7 label-offset = 0pt 8 }

9 \begin{exercise}

(11)

4 Available Options

12 \task The first task: easy!

13 \task The second task: even more so!

14 \end{tasks}

15 \end{exercise}

16 \begin{solution}[print]

17 Now, let's see\ldots\ ah, yes: 18 \begin{tasks}

19 \task This is the first solution. Told you it was easy.

20 \task This is the second solution. And of course you knew that! 21 \end{tasks}

22 \end{solution}

Exercise 1

I have these two tasks for you. Shall we begin? The first task: easy!

1.1 1.2 The second task: even more so!

Solution 1

Now, let’s see. . . ah, yes:

This is the first solution. Told you it was easy. 1.1

This is the second solution. And of course you knew that! 1.2

Finally let’s see what thedebugoption does (you could see it already on page6): 1 \settasks{debug}

2 \begin{tasks}(2)

3 \task \Sample

4 \task \Sample 5 \end{tasks}

This is some sample text we will use to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

a) This is some sample text we will use

to create a somewhat longer text span-ning a few lines. This is some sample text we will use to create a somewhat longer text spanning a few lines. This is some sample text we will use to create a somewhat longer text span-ning a few lines.

(12)

5 Available Instances

5

Available Instances

There are currently three additional instances for thetasksobject available:

itemize uses\labelitemias labels.

enumerate enumerates the items with 1., 2., . . .

1 \begin{tasks}[style=itemize](2) 2 \task that's just how\ldots 3 \task \ldots we expected

4 \end{tasks}

5 \begin{tasks}[style=enumerate](2)

6 \task that's just how\ldots 7 \task \ldots we expected 8 \end{tasks}

that’s just how. . .

• • . . . we expected

that’s just how. . .

1. 2. . . . we expected

6

Custom Labels

If you want to change a single label inside a list, you can use the optional argument of\task. This will temporarily overwrite the default label.

1 \begin{tasks}[style=itemize]

2 \task a standard item

3 \task another one

4 \task[+] a different one 5 \task and another one 6 \end{tasks} a standard item • another one • a different one +

and another one •

You’ve already seen examples for thelabeloption.

label= {hcodei} Default:\alph*)

It can be used to set the label for a list. A*inside is always replaced by the current counter

name inside braces. It can contain formatting instructions like\bfseriesbut it can be cleaner to use

(13)

7 Newtasks-like Environments

ref= {hcodei} (initially empty)

which sets\thehcounteri(\thetaskin the default setting).

1 \begin{tasks}[label=\arabic*.,ref=\

arabic*]

2 \task first item

3 \task second item \label{foo}

4 \end{tasks}

5 See item~\ref{foo} without dot.

first item 1.

second item 2.

See item2without dot.

Two additional commands are defined which in some circumstances might prove useful:

\tasksifmeasuringTF{htruei}{hfalsei}

introduced in v1.2

This command used inside a label checks if the label is typeset for measuring its width or if it is typeset “for real”. There are also the variants\tasksifmeasuringTand\tasksifmeasuringF. \tasklabel

introduced in

v1.3

Holds the current label text.

7

New

tasks

-like Environments

It is possible to add custom environments that work like thetasksenvironment. \NewTasksEnvironment[hoptionsi]{hnamei}[hseparatori](hcolsi)

Define environment hnameithat uses hseparatorito introduce a new item. Default for hseparatori is\task, default for hcolsiis1. The hoptionsiare the ones described in section4.

\RenewTasksEnvironment[hoptionsi]{hnamei}[hseparatori](hcolsi) Renew environment previously defined with\NewTasksEnvironment.

Thetasksenvironment is defined as follows:

1 \NewTasksEnvironment{tasks}

The separator does not have to be a control sequence:

(14)

8 Stylingta s k s

First task Second task

Although this might seem handy or even nice I strongly advice against using something different than a command sequence. Remember that the items will be split at every occurrence of the separator. So in order to use the separator (here for example for a starred variant of a command) within an item it has to be hidden in braces. This is avoided of you use a command sequence which even doesn’t have to be defined.

Please also keep in mind that the separator still has an optional star argument (see4), an optional bang argument and the standard optional argument. Using*will prevent the optional

star argument. 1 % preamble: 2 % \usepackage{fontawesome} 3 \NewTasksEnvironment[label=\faThumbsOUp,label-width=15pt]{done}[*] 4 \begin{done}(3) 5 * First task 6 * Second task

7 *! Third task spanning the full width available

8 * Fourth task

9 \end{done}

First task Second task

Third task spanning the full width available Fourth task

8

Styling

ta s k s

tasksuses xtemplate to declare additional instances for the lists.

8.1 ThetasksObject

The object that’s defined by tasks is the ‘tasks’ object. This time there are four instances available for the one template (again ‘default’) that was defined.

8.1.1 Available Options

(15)

8 Stylingta s k s

1 \DeclareTemplateInterface{tasks}{default}{3} 2 {

3 % option : type = default

4 label : tokenlist = \alph*) ,

5 indent : length = 2.5em ,

6 label-format : tokenlist ,

7 label-width : length = 1em ,

8 label-offset : length = .3333em ,

9 after-item-skip : skip = 1ex plus 1ex minus 1ex 10 }

8.1.2 Predefined Instances

This is rather brief this time:

1 % alphabetize: a) b) c)

2 \DeclareInstance{tasks}{alphabetize}{default}{} 3 % itemize

4 \DeclareInstance {tasks} {itemize} {default} 5 {

6 label-width = 1.125em ,

7 label = \labelitemi

8 }

9 % enumerate:

(16)

9

References

[Bez19] Javier Bezos. enumitem. version 3.9, June 20, 2019 (or newer). url:https://ctan.org/pkg/enumitem.

[L3P] The LATEX3 Project Team. l3kernel. Oct. 27, 2020 (or newer).

url:https://www.ctan.org/pkg/l3kernel/.

[Nie19] Clemens Niederberger. exsheets. version 0.21k, Sept. 30, 2019 (or newer). url:https://ctan.org/pkg/exsheets.

[Nie20] Clemens Niederberger. xsim. version 0.19a, Mar. 19, 2020 (or newer). url:https://ctan.org/pkg/xsim.

[Rob14] Will Robertson. environ. version 0.3, May 4, 2014 (or newer). url:https://ctan.org/pkg/environ.

10

Index

A after-item-skip. . . .9 after-skip. . . .9 B before-skip. . . .9 Bezos, Javier . . . .8 C column-sep. . . .9 counter. . . .9 counter-format. . . .2 ctan . . . .2 D debug. . . .9,11 E enumerate(environment) . . . .2 enumitem(package) . . . .2,8 environ(package) . . . .3 exercise(environment) . . . .10 exsheets(package) . . . .1 I item-format. . . .8 item-indent. . . .8 L l3kernel(bundle) . . . .2 label. . . .8,12 label-align. . . .9 label-format. . . .8,12 label-offset. . . .8 label-width. . . .8f. lppl . . . .2 N \NewTasks. . . .2 \NewTasksEnvironment. . . .13f. Niederberger, Clemens . . . .1,10 R ref. . . .8,13 \RenewTasks. . . .2 \RenewTasksEnvironment. . . .13 resume. . . .9 Robertson, Will . . . .3 S \settasks. . . .6,8,10f. start. . . .9 \startnewitemline. . . .7 style. . . .8 T \task. . . .2–7,9–14 \tasklabel. . . .13 tasks(environment) . . .1ff.,7ff.,13 \tasksifmeasuringF. . . .13 \tasksifmeasuringT. . . .13 \tasksifmeasuringTF. . . .13

The LATEX3 Project Team . . . .2

\thetask. . . .8,13 X xparse(package) . . . .2

Referenties

GERELATEERDE DOCUMENTEN

As it, first, provides further indication on the possible configurational nature of reactivity, second, supports the understanding that differences in

But the result shows that a significant relationship found only in formal institutional factors (rule of law and property right protection), while informal institutional

Because yet so little is known, the first goal of this study is to give an overall picture of the development of hedge fund activism, including the size of activism, the stake

Koeien die al langere tijd een langdurig verhoogd celgetal hebben, komen niet altijd voor op de attentielijst.. Daarom blijft het bepalen van het koecelgetal

WebSphere is a software family brand of which the following components can be used for robust (levee) monitoring systems. These software products are availability on a variety

Applying Teece’s (2007) ideas to the audiovisual industry, the researchers previously investigated the link between sensing and seizing capabilities and

In summary: The general role of basic research is likely not to change for firms acting in disruptive environments, mostly due to the disadvantages of conducting research