New answers tagged

1

David Carlisle already proposed passing (via \expandafter) the toplevel-expansion of \fragment to an auxiliary macro called \helper. The purpose of this auxiliary macro is rather specific. A more general variation of this approach is combining usage of \expandafter (for obtaining \fragment's toplevel-expansion) with usage of a macro \exchange which does ...


1

Sorry, but \patchcommand is not the best tool for the job. Not knowing your real situation, I'll solve the problem you show. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\iterations}{mm} {% #1 = text, #2 = number of iterations \fiat_iteration:nn { #1 } { #2 } } \tl_new:N \l__fiat_iteration_in_tl \tl_new:N \...


1

ifthen and xstring commands are not expandable and probably would not be my first choice here (even though I wrote the first of those) however you can expand \fragment before using it by re-arranging the call slightly \documentclass[]{article} \usepackage{ifthen} \usepackage{patchcmd} \usepackage{xstring} \newcommand\myText{Hac est sententia.} \newcommand\...


0

With pgfmath: \documentclass[]{article} \usepackage{tikz} \usepackage{pgfplotstable} \pgfplotsset{compat=newest} \begin{document} \section{In the Document and as outfile - good} \newwrite\kanaoutfile \immediate\openout\kanaoutfile=KanaData.txt% \newcommand{\row}{}% reserv Name \foreach[count=\y from 0] \Y in {{}, {}, K,S,T,N,H,M,Y,R,W}{%%% \let\row=\empty%...


1

You might be interested in Dr. Nicola Talbot's datatool-package for maintaining databases and for iterating on elements of records of databases. Examples on how to approach the matter using the datatool-package are at the end of this answer. Be that as it may. \csname..\endcsname might be your friend: \documentclass{article} \usepackage{tikz} \begin{...


1

Does this help? \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,bending,automata,positioning} \begin{document} \begin{tikzpicture}[shorten >=1pt,node distance=4cm,on grid] \node[state] (c) {id}; \node[state] (a) [above left of= c] {$a$}; \node[state] (b) [above right of= c] {$b$}; \path[->] (a) edge [bend right=40] node[...


3

See ADDENDUM for a more expansive implementation. I think listofitems is useful for this. \documentclass{article} \usepackage{listofitems} \newcommand\newcommands[2]{% \readlist*\cmdtxt{#2}% \foreachitem\z\in\cmdtxt[]{% \expandafter\gdef\csname#1\romannumeral\zcnt\expandafter\endcsname \expandafter{\z}% }% } \begin{document} \newcommands{...


2

See pgfmanual sec 89 Repeating Things \documentclass{article} \usepackage{tikz} \usepackage[siunitx, RPvoltages]{circuitikz} \begin{document} \begin{circuitikz} \tikzset{ mux 10by2/.style={muxdemux,muxdemux def={Lh=10, NL=10, Rh=8,NB=0,NT=2, w=2} } } \node [mux 10by2](MuxA) at (0,0){MUX}; \foreach \x [count=\...


1

In OpTeX, you can use \fornum macro: \def\myrepeat#1#2{\fornum 1..#1\do {#2}} \myrepeat{4}{x} \myrepeat{4}{\myrepeat{2}{x}} \message{\myrepeat{4}{\myrepeat{2}{x}}} % prints xxxxxxxx on the terminal. \bye The \fornum macro is fully expandable, you can use nested loops without opening or closing group.


Top 50 recent answers are included