Hot answers tagged

3

This answer mimics that of egreg, but uses the readarray package to absorb the input file into a macro. \begin{filecontents*}[overwrite]{mydata.dat} 1,2,3 \end{filecontents*} \documentclass{article} \usepackage{pgffor} \usepackage{readarray} \newcommand{\foreachinfile}[2]{% \readdef{#2}{\foreachinfiletemp}% \foreach #1 in \foreachinfiletemp } \begin{...


3

You can store the file contents in a temporary macro, with the help of catchfile: \begin{filecontents*}{\jobname-example} 1,2,3 \end{filecontents*} \documentclass{article} \usepackage{pgffor} \usepackage{catchfile} \newcommand{\foreachinfile}[2]{% \CatchFileDef{\foreachinfiletemp}{#2}{}% \foreach #1 in \foreachinfiletemp } \begin{document} \foreach \...


3

As far as I understand what you want, here's a way to start with. I didn't know how you want to distribute the colours, though: \documentclass[tikz,border=3.14mm]{standalone} \usetikzlibrary{graphs} \begin{document} \begin{tikzpicture}[main/.style = {draw, circle, inner sep=1.2, fill=black}] \node[main, label=right:{$e$}] at (360:0mm) (0) {}; \...


2

Thank you for the posted solutions! based on them, here is the final code: \begin{tikzpicture}[main/.style = {draw, circle, inner sep=1.2, fill=black}] \node[main, label=right:{$e$}] at (360:0mm) (0) {}; \graph[circular placement, group polar shift=(360/215:0), empty nodes, radius=6cm, nodes={circle, inner sep=1.2, draw=black, fill=black}] { ...


1

Here's one way to define a sequence of macros with a for loop, with an example of usage: \documentclass{article} \usepackage{pgffor} \def \peopleArray {\nameA, \nameB, \nameC} \begin{document} \foreach \x in \peopleArray { \expandafter\newcommand\x{}% error if already defined \expandafter\gdef\x{ \begin{center} {\scshape name3} \end{...


1

You want to evaluate \x+1. \documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs} \begin{document} \begin{tikzpicture}[ main/.style = {draw, circle, inner sep=1.2, fill=black} ] \node[main, label=below:{$e$}] at (360:0mm) (0) {}; \graph[ circular placement, group polar shift=(360/26:0), empty nodes, radius=6cm, nodes={circle, inner ...


1

\documentclass[margin=5mm, varwidth]{standalone} \usepackage{tikz} \begin{document} \section{Normal Tabbing} \begin{tabbing} Left \= Middle \= Right \kill 1 \> 2 \> 3 \\ \end{tabbing} \section{Foreach Tabbing} \newcommand\tabrow[1]{% \setlength{\topsep}{2pt}% \setlength{\partopsep}{0pt}% \begin{tabbing} Left \= Middle \= Right \kill% tabhead %1 \> ...


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