Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## #642 Improved cwl format and latex parser

None
open
nobody
None
1
2014-11-09
2014-01-21
Tim Hoffmann
No

The current cwl format definition and the latex parser have some fundamental limitations. This request ist intedend to collect the information which usecases have to be covered by the parser and how an improved cwl format could look like. It's nowhere said that we'll have time to start this anytime soon. It would be a major project because it also needs a new latex parser. However, it's good to collect these information in a single place.

The current limitations are:

• Only the first argument can have special meaning, all other are ignored.
• The information from the argument cannot be manipulated.
• There is only a fixed set of types, which may need extension, a command cannot have multiple types.
• Keyword arguments are not supported.

## Discussion

• Tim Hoffmann
2014-01-21

Usecases:

\import{path}{file}: Should be recognized as \include-like statement path and file should be joined to determine the included file (see also).

\cref{label1,label2}: Multiple labels should be referenceable. This list definition is currently not supported for references. Note: it is for citations. But it would be necessary to be able to to specify if a command accepts only single entries or list (see also).

\textcquote{bibid}{text} or \mycite{param}{bibid}: it should be possible to define which of the arguments has a special meaning (see also).

Keyword arguments lists should be supported. e.g. the ctable package defines the label via a keyword in an optional argument (see also).

\myfiginsert{label}{file}: It should be possible to have muliple arguments with different meanings in one command.

Arguments might behave like environments, e.g. the mchem package provides a command \ce{}. Its content is interpreted as math. Same with \ensuremath{}.
Also related: \path{PATH=$(ROOTSYS)\bin} or redefined verbatim should not treat the contained$ as start of math.

Last edit: Tim Hoffmann 2014-03-16

• Tim Hoffmann
2014-01-21

Possible formats:

Assume a hypothetical \citelink{cite}{url} command taking a reference as the first element, a url as the second argument. Additionally it is a rare command.

Possible formats maintaining the current cwl structure would be:

Inline:

\citelink{cite%c}{url%U}#*


Not sure if mixing text and formats is a good idea. There may also be %< %> and %| in there and then it becomes more and more unreadable.

After # v1:

\citelink{cite}{url}#*#c#u  // i.e. #<global>#<first_arg>#<second_arg>


After # v2:

\citelink{cite}{url}#*1:c2:u  // i.e. #<global>1:<first_arg>2:<second_arg>


Then, the single chararcter specifiers are hard to remember and read. Why not use whole words?

It is also possible to bind certain argument names to a meaning, e.g.

\citelink{cite}{url}


where cite implicitly means a citation and url means a link.

Drawback: We directly bind the placeholder name to a functionality. The user cannot choose the placeholder name (also one might think of translated cwls, which would not be possible with this approach).

Sideremark: Another requested feature is
\import{path/}{filename}

Moreover, there is also the %<placeholder%> and %| cursor position syntax to be considered. Should it be maintained as is? Is it sufficiently flexible?

• Tim Hoffmann
2014-11-09

\autocites[123]{Anything}[321]{Another}

Spellchecking in options of \begin depending on other arguments, e.g. (package beamer). Second argument should be checked if first argument of \begin is frame:
\begin{frame}{frametitle}