New answers tagged

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{...


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}] { ...


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) {}; \...


0

based on comments provided and other posts, I ended up with the following: \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/26:0), empty nodes, radius=4cm, nodes={circle, inner sep=1.2, draw=black, fill=black}] { \foreach \x ...


0

May I suggest a simpler way to do that? \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[dot/.style={circle,fill=black,inner sep=1.2pt}] \coordinate (0) at (0,0); \def\r{6} \foreach \i [evaluate=\i as \j using \i+1] in {1,3,...,25} \draw (0) -- (\i*360/26-360/52:\r) node[dot](\i){} -- (\j*360/26-360/52:\r) ...


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 ...


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 \...


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 \> ...


Top 50 recent answers are included