How to start the numbering of figures at a specific digit in ConTeXt - tex

How can I start the numbering of figures at a specific digit in ConTeXt.
Minimal example:
\setuppapersize[A6]
\setupexternalfigures[location=default]
\setupcaptions[way=bytext]
\placefigure
{Cow}
{\externalfigure[cow][width=2cm]}
\placefigure
{Another Cow}
{\externalfigure[cow][width=2cm]}

\setuppapersize[A6]
\setupexternalfigures[location=default]
\setupcaptions[way=bytext]
\setnumber[figure][2]
\placefigure
{Cow}
{\externalfigure[cow][width=2cm]}
\placefigure
{Another Cow}
{\externalfigure[cow][width=2cm]}

Related

How may I convert a three-digit Arabic number (Perl [0-9][0-9][0-9]) to a three-digit English representation ([zero-nine][zero-nine][zero-nine])

The alternative is to use Roman numerals, for which a package is
available. I am using the LaTeX catchfile package and the \input{}
command to associate a title in a set of TITLE files with \section{}
commands in a set of DOCUMENT files.
I would like to have a file of catchfile definitions, with records
such as:
\CatchFileDef{\t-001}{title-001.tex}{}
\CatchFileDef{\t-002}{title-002.tex}{}
\CatchFileDef{\t-003}{title-003.tex}{}
But LaTeX does not allow numerical labels such as "\title-003".
Roman numerals are workable:
\CatchFileDef{\ti}{title-001.tex}{}
\CatchFileDef{\tii}{title-002.tex}{}
\CatchFileDef{\tiii}{title-003.tex}{}
but are ugly in comparison with:
\CatchFileDef{\tzerozeroone}{title-001.tex}{}
\CatchFileDef{\tzerozerotwo}{title-002.tex}{}
\CatchFileDef{\tzerozerothree}{title-003.tex}{}
On possibility to convert digits into their corresponding words is the numspell package:
\documentclass{article}
\usepackage{numspell}
\usepackage{pgffor}
\begin{document}
\foreach \x in {0,...,9}{
\foreach \y in {0,...,9}{
\foreach \z in {0,...,9}{
\x\y\z : \numspell{\x}\numspell{\y}\numspell{\z}
}}}
\end{document}
In an hour or two, using Emacs, I created a look up table which solved the problem. The English spelling of Arabic numerals appears to be less prone to error than is the use of Roman numerals.

Bibliography Customisation for Overleaf

I currently have this code:
\usepackage[
backend=biber,
citestyle=authoryear,
bibstyle=authoryear,
maxcitenames=2,
maxbibnames=99]{biblatex}
\addbibresource{reference.bib}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\DeclareNameAlias{sortname}{family-given}
\setlength\bibitemsep{1em}
Which prints the bibliography like this:
Birrell, S. and Donnelley, P. (2004). “Erving Goffman’s Influence on
the Sociology ofSport”. In: ed. by R. Giulianotti. Sport and Modern
Social Theorists. London: Pal-grave Macmillian UK, pp. 49–64.
This is the info from the .bib file:
#inbook{birrel:2004,
author={S. Birrell and P. Donnelley},
editor={Giulianotti,R.},
year={2004},
title={Erving Goffman's Influence on the Sociology of Sport},
series={Sport and Modern Social Theorists},
publisher={Palgrave Macmillian UK},
address={London},
pages={49-64}
}
I need to remove the parentheses from around the year to conform to Leeds Harvard style, which is like this:
Family name, INITIAL(S). Year. Title of article. Journal Title. Volume(issue number), page numbers.
Help!

Prefix numbering in figure captions with S in ConTeXt

I am compiling some figures as supplementary material and would like to have figure captions follow the convention:
Figure S1, Figure S2, Figure S3, …
How can I achieve this?
Minimal example:
\setuppapersize[A6]
\setupexternalfigures[location=default]
\setupcaptions[way=bytext]
\placefigure
{Cow}
{\externalfigure[cow][width=2cm]}
\placefigure
{Another Cow}
{\externalfigure[cow][width=2cm]}
\setuppapersize[A6]
\setupexternalfigures[location=default]
\setupcaptions[way=bytext, numbercommand=S]
\placefigure
{Cow}
{\externalfigure[cow][width=2cm]}
\placefigure
{Another Cow}
{\externalfigure[cow][width=2cm]}

inputting all items of a list into an environment

I have a list of names which I would like to input into a given surrounding, e.g. a box. Put in a different way: I'd like LaTex to create a surrounding for every item in a given list.
Here's my list:
Frank, Fred, Fran
Here's my surrounding:
\fbox{\name}
\name does the following: it inputs the first item from the list and creates another \fbox for each successive item in the list until the end of the list, as a result outputting the same as (but saving the typing of)
\fbox{Frank}
\fbox{Fred}
\fbox{Fran}
I am thinking of the list of names as a "count" (redefining 1 as Frank, 2 as Fred...) and this might be the wrong approach.
I realise that a command can probably not do those two things at once.
If there's a simple solution to this: what is it called and where can I find it? searching for 'variables' or 'foreach' didn't help.
Depending on your application, you can either specify the list explicitly, or in a file:
As an explicit list (see How to iterate over a comma separated list?):
\documentclass{article}
\usepackage{etoolbox}
\newcommand{\printlist}[1]{%
\begin{enumerate}
\renewcommand*{\do}[1]{\item \fbox{##1}}%
\docsvlist{#1}%
\end{enumerate}%
}
\begin{document}
\printlist{Frank, Fred, Fran}
\end{document}
As a file in (say) names.csv:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{names.csv}
Frank
Fred
Fran
\end{filecontents*}
\usepackage{datatool}
\newcommand{\printlist}[1]{%
\DTLloaddb[noheader,keys=name]{namesdb}{#1}% Load names database file
\begin{enumerate}
\DTLforeach{namesdb}{\name=name}{\item \fbox{\name}}
\end{enumerate}
}
\begin{document}
\printlist{names.csv}
\end{document}
In both instances, the output resembles:

Controlling LaTeX column flow

What I'm trying to do: I have a page that consists of pairs of two sentences each. The pairs are separated by a whole line break. My problem is that when I have an odd number of pairs, the second sentence will automatically be placed on the next column.
How can I use LaTeX to make block structures that multicol does not ignore, to keep the two sentences together? If there's better code to solve this problem, or a better column implementation (though I don't believe I can use \twocolumn in the document declaration), please post it.
My current code:
\documentclass{article}
\usepackage{fullpage}
\usepackage{multicol}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\newcommand{\pair}[2]{
\emph{#1}\\*
#2
}
\begin{document}
\begin{multicols}{2}
\pair{Sentence 1.}{Sentence 2.}
\pair{Sentence 2 (pair 2).}{Sentence 2 (pair 2).}
\pair{The last pair, first sentence.}{Last sentence.}
\end{multicols}
\end{document}
This generates: http://img541.imageshack.us/img541/3444/columns.png . The second pair is what I am trying to avoid.
Try this:
\newcommand{\pair}[2]{%
\parbox{\hsize}{\emph{#1}\\*#2}\par}

Resources