Tag Info

New answers tagged

1

Run with lualatex (the number of rows is not limited): \documentclass[border=5]{standalone} \usepackage{luacode,array} \def\PascalTriangle#1{\directlua{PascalTriangle(#1)}} \begin{luacode} function nextrow(t) local ret = {} t[0], t[#t+1] = 0, 0 for i = 1, #t do ret[i] = t[i-1] + t[i] end return ret end function PascalTriangle(n) ...


3

The following should do it. By using the fpu library it is possible to go beyond the usual limit of 17 rows in PGF. \documentclass[tikz,border=5]{standalone} \usepgflibrary{fpu} \begin{document} \def\N{10} \tikz[x=0.75cm,y=0.5cm, pascal node/.style={font=\footnotesize}, row node/.style={font=\footnotesize, anchor=west, shift=(180:1)}] \path ...


8

When using xpatch (or the original commands in etoolbox) for patching macros, it's recommended to use the builtin diagnostics, that is \tracingpatches and the “fail” argument. If you add \tracingpatches to the preamble, before your usage of \IfPackageLoaded, you'll get the message [debug] tracing \pretocmd on input line 26 [debug] analyzing ...


1

This uses algoritmm Code \documentclass[titlepage,oneside,12pt]{article} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm} \caption{Initialization} \begin{algorithmic}[1] \Require Given the M detected objects \Ensure new clusters \For {(each object $i$)} \State Create new cluster $C_i$; ...


1

You are mixing up commands from the packages algorithm2e and algorithm. Well, I believe you do. See my following MWE. This does compile and uses the syntax provided by the documentation here. Is this what you wanted to type? % arara: pdflatex \documentclass[titlepage,oneside,12pt]{article} \usepackage{algpseudocode,algorithm2e} \begin{document} ...


1

I have finally managed to apply percusee's answer (here) to my problem. It works with the following loop: \makeatletter \foreach \n in {0,...,7}{ \xdef\doanchor{ \noexpand\anchor{in\n}{ \noexpand\pgfpoint{.5*\w}{7*.25cm-\n*.5cm} } } \doanchor } \makeatother


8

The usual approach to grabbing tokens with a delimiter in TeX would be something like \catcode`\@=11 % \def\grabargs#1#2#3{% \def\grabargs@aux##1#2{% \ifx\relax##1\relax% \else #3{##1}\par \expandafter\grabargs@aux \fi }% \grabargs@aux#1#2\relax#2 } \def\print#1{`{\tt #1}'} \catcode`\@=12 % \grabargs {Humpty Dumpty sat on a ...


0

I'm not sure if such a package exists; but I managed to cook one up, so I'll be posting it here. (if a package like this hasn't existed, and if it is useful, feel free to mod and eventually post on CTAN; unfortunately, I currently do not have the time to do that procedure, or to maintain in general) The only problem so far seems to me to be, that the ...


0

Working through my implementation: \pgfplotsinvokeforeach{0,...,\numberofrows}{ I used row=#1 at first, then changed to row= #1 and it is now fine. Regards, Dave.


3

This is solved by evaluating the array element first. Getting the element requires you pass an integer as an index, not a number in fixed point notation. I have moved the evaluation of the array element outside the loop as it does not vary with the iteration. \documentclass{article} \usepackage{tikz} \usetikzlibrary{fpu} \usepackage{expl3} ...


5

The problem here is that arrayjob does some nasty stuff to get the value out of the array and this is not compatible with how \includegraphics handles its arguments. There are two solutions: 1. expand and then use \documentclass[class=minimal,border=0pt,tikz]{standalone} \usepackage{tikz} \usepackage{arrayjob} \begin{document} \newarray\ggg ...


4

Here is one way: Notes: I would recommend you put everything prior to the first \AddRevision in a separate package and have the users add the revisions before \begin{document}. References: Build tabular content via \foreach How to automatically add text immediately after \begin{document} Code: \documentclass{article} %% ...


4

You were just missing a semicolon. Semicolons are very important in TikZ. In fact, one could say that TikZ is less like LaTeX and more like C or Java in this respect. The following works: \foreach \i in {1,...,4} \drawtetra\i; You could alternately use a group, then you don't need the semicolon. \foreach \i in {1,...,4} { \drawtetra\i }


4

The etoolbox package has several functions for managing lists, but I'll show a different approach using xparse and expl3, the programming environment for LaTeX3. I'll define macros for managing as many lists as you want. The macro \addtolist adds to a list; the macro \printlist maps through a list using the command given as optional argument (default is ...


1

Any looping command will do, I used \forloop from the equally named package and defined a command \getfulltext[]{number of textelements} The first optional argument defaults to [ ] (white space between!!!) and acts as a separator of individual text elements. If no space is wanted, use [] explitly when calling. However, the command does used \gettext ...



Top 50 recent answers are included