# Tag Info

19

This will most likely break everything, \jobname is used for all kinds of things like aux files and having commas and spaces in file names is tricky. Just use pdflatex \def\mycommand{a,b,c}\input myfile possibly needing to quote the \ or {} depending on your commandline processor.

18

One possibility is to use the xparse package: \usepackage{xparse} \NewDocumentEnvironment{mylist}{m}{% \begin{#1}% % other code }{% \end{#1}% }

18

You could use the xstring package \documentclass{article} \usepackage{xstring} \newcommand{\mymacro}[1]{% \StrLeft{#1}{1}[\firstletter]% \StrRight{#1}{1}[\lastletter]% First letter: \firstletter Last letter: \lastletter } \begin{document} \mymacro{ABCDEF} \end{document} I’m a little busy so please excuse that I didn’t build it in ...

17

Here is a preliminary example (depending on what you are looking for) using a for loop, \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \def\repeatno{40} \node[inner sep=0.5cm,circle] (base) at (0,0) {}; \foreach \x in {1,2,...,\repeatno}{ \draw[rotate=(\x*360/\repeatno)-90] (base.\x*360/\repeatno) to [in=-70,out=70] ++(0,2) ...

16

I'm not sure to really understand the question. First I draw a closed curve and then I rotated this curve but there are no difficulty to do this, perhaps I'm on a wrong way! First curves : the closed curve is named \myclosedcurve \documentclass[11pt]{scrartcl} \usepackage{tikz} \begin{document} \def\spirographlike#1{% \def\repeatno{#1} \foreach \i in ...

16

Or in classic TeX; the following defines \fst and \lst to be the first and last characters (or be empty for short input) \def\fl#1{\flx#1\empty\empty\empty} \def\flx#1#2#3\empty{% \edef\fst{#1}% \edef\cdar{#2}% \edef\cddr{#3}% \ifx\cddr\empty \let\lst\cdar \else \expandafter\flxx \fi #3} \def\flxx#1#2\empty{% \edef\car{#1}% ...

15


14

The problem here is that the character must be already active when used for \def. The #1 argument however holds the same character in its previous catcode and this won't be affected by \catcode. There is a trick using \lowercase but I'm not sure if it works well with non-ASCII characters with normal LaTeX. You can use \scantokens (an eTeX extension ...

14

There is more than one problem with such a definition. The \def instruction has the following syntax: \def<cs><parameter text><left brace><balanced text><right brace> where <cs> is the control sequence or active character to define; <left brace> and <right brace> stand for explicit braces (character tokens ...

12

Package gb4e makes the characters _ and ^ active. Their definitions disturb \includegraphics, where _ should be expandable and expand to itself. Either use \noautomath that resets the catcodes: \noautomath \includegraphics{Erg_Dat_Agree} Or \string that converts the next token _ to a character token with catcode "other" (12): ...

12

Here are 3 solutions using expl3, depending on your requirements. To perform the tests, I'd use \prg_case_int:nnn rather than an ad-hoc bunch of \ifthenelse statements: those are slower. (1) The simplest is to use \tl_head:n{#1} to access the first digit of the number, and \int_mod:nn {#1}{10} for the last one. This works for numbers less than 2^{31}, and ...

12

\usepackage{newunicodechar} \newunicodechar{¼}{1/4} \newunicodechar{«}{<<} \newunicodechar{—}{---}

11

The following example uses the syntax that the arguments are given inside the argument for the command: \images{{...}{...}{...}{...}{...}{...}...}. The macro \images then parses its argument and catches three arguments at a time: \documentclass{article} \newif\ifimagesSep \newcommand*{\images}[1]{% \par\noindent[begin images]\\\relax \imagesSepfalse ...

11

The trick storing the second parameter as macro and using it in the "end" part of the environment: \newenvironment{ctable}[2]% {% \def\ctablecaption{#2}% \begin{center}% \begin{tabular}{#1}% }% {% \end{tabular}% \captionof{table}{\ctablecaption}% \end{center}% }

10

You can have a variable number of items by rethinking your usage of a tabular and using an inline list. \documentclass{article} \makeatletter \newcounter{inline} \def\inlinelist#1{% \setcounter{inline}{0}% \@for\next:=#1\do{% \stepcounter{inline}% \alph{inline})\thinspace\next\space} } \makeatother \begin{document} ...

10

I have a solution, though it's not quite what I had envisioned. From the answers (and lack of answers) I have come to believe that continuous rotations are not a built-in feature of tikz, so I took the suggestions of Jake and Altermundus to just program in all the math calculations myself using polar coordinates. Below is my solution and its output. % ...

9

Using the environ package you can avoid the standard trick illustrated in Heiko's answer: \documentclass{article} \usepackage{capt-of} \usepackage{environ} \NewEnviron{ctable}[2]% {% \begin{center}% \begin{tabular}{#1}% \BODY \end{tabular}% \captionof{table}{#2}% \end{center}% } \begin{document} \begin{ctable}{cc}{test} test & test ...

9

You're trying to avoid floating tables, which is quite dangerous. Moreover you lose flexibility. However, if you really want to shoot yourself in the foot ;-), here's a possibility: the package xparse. \documentclass{article} \usepackage{xparse,capt-of} \NewDocumentEnvironment{ctable}{mm} % two arguments in braces {% begin part \begin{center} ...

8

The underlying idea here is to continuously rotate the paper whilst drawing the picture with TikZ. This is, of course, impossible. The difficulty with this is that the resulting path from doing this wouldn't (necessarily) be composed of lines and cubic bezier curves, which is all that PGF knows how to produce. But curves are really just lots of short ...

8

To scan a character at a time you need to use \futurelet (or its LaTeX wrapper \@ifnextchar) not a macro argument #1 then it is safe for {}. But for numbers I would just do this: \documentclass{article} \begin{document} \makeatletter \def\num{\afterassignment\xnum\count@} \def\xnum{the number was [\the\count@]} \num44 \emph{\num99} \end{document} ...

8

You have to define \dollarcom with a "stringified #": \documentclass{article} \usepackage{minted} \edef\dollarcom{\noexpand\mint{bash}/$\string#/} \begin{document} \dollarcom \mint{bash}|$#| \end{document}

8

You need to move your \defs outside the tikzpicture (otherwise, they don't survive the group created for the environment). The caption is provided using \caption{$y=\protect\polynomial{\g,\f,\e,\d,\c,\b,\a}$} where \polynomial from the polynomial package gives the desired formatting for the polynomials. In fact, the code uses a redefinition of ...

7

It's not a definitive answer because I don't know how do you want to use this symbols and the code don't use conditioned styles. What I've done was to use pics (you need TikZ 3.0). The first pic clock draws the common part of your symbols and the other three pics use it (fixing its filling color) and draw particular characteristics. At the moment, each ...

7

As you correctly state, if all you need to do is store the user input, then a token list variable is the usual approach unless there is some 'structure' to think about. I would therefore define \NewDocumentCommand \myAssessments { O { I } O { cc } +m } { \tl_gset:Nn \g_myA_tl {#1} \tl_gset:Nn \g_myB_tl {#2} \tl_gset:Nn \g_myC_tl {#3} } ...

7

Try \StrRight in the xstring package: \documentclass{article} \usepackage{xstring} \def\getYear#1{\StrRight{#1}{4}} \begin{document} \noindent\getYear{12.12.2012}\\ \getYear{2012} \end{document} with result:

7

You can use the etoolbox to set up a boolean which is either true or false \newbool{hidetrafficlight} \setbool{hidetrafficlight}{false} and then depending on what value it takes, use \AtBeginEnvironment from the etoolbox to comment out the environment using comment from the verbatim package % set conditional behaviour of environment ...

7

Here is a key-value interface. I use skeyval package instead of pgfkeys only because I wanted to preset keys. \documentclass{article} \usepackage{skeyval} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \makeatletter % Spurious spaces will appear in the following methods in horizontal % mode, but TikZ doesn't mind them. The star (*) form of \directkeys ...

7

You can avoid this error by modifying your class definition as follows: \ProvidesClass{UGentCourse}[2011/07/28 v1.0 UGentCourse] \DeclareOption{english}{\AtEndOfClass{\main@language{english}}} \DeclareOption{dutch}{\AtEndOfClass{\main@language{dutch}}} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} \ProcessOptions\relax ...

7

This depends on the font size selected for the document class or within the text and whether you're in \twocolumn or not (at least, for the default document classes). For the exact lengths, you need to view size10.clo, size11.clo, size12.clo in conjunction with the document class you're using. The following minimal example lists these totals for the various ...

6

Here are a couple of options to get you started- of course, Paulo might provide better alternatives :) makepowerdot.yaml !config # Make chapter files rule for arara # author: Chris Hughes # last edited by: cmh, Dec 2nd 2013 # http://tex.stackexchange.com/questions/148095/using-arara-to-compile-powerdot-twice # requires arara 3.0+ identifier: makepowerdot ...

Only top voted, non community-wiki answers of a minimum length are eligible