Undefined control sequence error?












1















I am playing with the code adapted from here.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreac x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in #2{%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


When I compile, I am getting following error without output. Can anybody help with this?



ERROR: Undefined control sequence.
--- TeX said ---
trigram ...-- (1.1,3) -- (0,0) -- cycle; foreac
x [count=xx starting fro...l.23 trigram{0}{b,w,w}
;









share|improve this question


















  • 3





    Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

    – Phelype Oleinik
    Jan 24 at 20:18
















1















I am playing with the code adapted from here.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreac x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in #2{%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


When I compile, I am getting following error without output. Can anybody help with this?



ERROR: Undefined control sequence.
--- TeX said ---
trigram ...-- (1.1,3) -- (0,0) -- cycle; foreac
x [count=xx starting fro...l.23 trigram{0}{b,w,w}
;









share|improve this question


















  • 3





    Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

    – Phelype Oleinik
    Jan 24 at 20:18














1












1








1








I am playing with the code adapted from here.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreac x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in #2{%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


When I compile, I am getting following error without output. Can anybody help with this?



ERROR: Undefined control sequence.
--- TeX said ---
trigram ...-- (1.1,3) -- (0,0) -- cycle; foreac
x [count=xx starting fro...l.23 trigram{0}{b,w,w}
;









share|improve this question














I am playing with the code adapted from here.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreac x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in #2{%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


When I compile, I am getting following error without output. Can anybody help with this?



ERROR: Undefined control sequence.
--- TeX said ---
trigram ...-- (1.1,3) -- (0,0) -- cycle; foreac
x [count=xx starting fro...l.23 trigram{0}{b,w,w}
;






tikz-pgf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 24 at 20:17









Tony TanTony Tan

1116




1116








  • 3





    Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

    – Phelype Oleinik
    Jan 24 at 20:18














  • 3





    Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

    – Phelype Oleinik
    Jan 24 at 20:18








3




3





Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

– Phelype Oleinik
Jan 24 at 20:18





Welcome to TeX.SE! You have a typo in the code. It's foreach, not foreac.

– Phelype Oleinik
Jan 24 at 20:18










1 Answer
1






active

oldest

votes


















5














You spelled foreach wrong and you are missing a set of braces around #2.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreach x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in {#2} {%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

    – Tony Tan
    Jan 24 at 20:42






  • 1





    @TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

    – Henri Menke
    Jan 24 at 20:56











  • @marmot Sorry but I no longer waste my time drawing other people's pictures.

    – Henri Menke
    Jan 24 at 22:53











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471722%2fundefined-control-sequence-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














You spelled foreach wrong and you are missing a set of braces around #2.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreach x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in {#2} {%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

    – Tony Tan
    Jan 24 at 20:42






  • 1





    @TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

    – Henri Menke
    Jan 24 at 20:56











  • @marmot Sorry but I no longer waste my time drawing other people's pictures.

    – Henri Menke
    Jan 24 at 22:53
















5














You spelled foreach wrong and you are missing a set of braces around #2.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreach x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in {#2} {%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

    – Tony Tan
    Jan 24 at 20:42






  • 1





    @TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

    – Henri Menke
    Jan 24 at 20:56











  • @marmot Sorry but I no longer waste my time drawing other people's pictures.

    – Henri Menke
    Jan 24 at 22:53














5












5








5







You spelled foreach wrong and you are missing a set of braces around #2.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreach x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in {#2} {%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer













You spelled foreach wrong and you are missing a set of braces around #2.



documentclass{article}
usepackage{tikz}
tikzset{
nodeline/.style={midway, rotate=#1, minimum height=3.5mm, minimum width=2.5mm},
}

newcommandtrigram[2]{%
begin{scope}[rotate=#1]% around={#1:(0,0)}
defalenanno{w} %if it is ying
clip (-1.1,3) -- (1.1,3) -- (0,0) -- cycle;
foreach x [count=xx starting from 0, evaluate=xx as y using (1.75+.5*xx)] in {#2} {%
ifxxalenanno
draw[line width=3mm] (-1.2,y) -- (1.2,y) node[nodeline=#1,fill=white] {};
else
draw[line width=3mm] (-1.2,y) -- (1.2,y);
fi
}
end{scope}
}

begin{document}
begin{tikzpicture}
trigram{0}{b,w,w};
end{tikzpicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 24 at 20:23









Henri MenkeHenri Menke

72.6k8160270




72.6k8160270













  • Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

    – Tony Tan
    Jan 24 at 20:42






  • 1





    @TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

    – Henri Menke
    Jan 24 at 20:56











  • @marmot Sorry but I no longer waste my time drawing other people's pictures.

    – Henri Menke
    Jan 24 at 22:53



















  • Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

    – Tony Tan
    Jan 24 at 20:42






  • 1





    @TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

    – Henri Menke
    Jan 24 at 20:56











  • @marmot Sorry but I no longer waste my time drawing other people's pictures.

    – Henri Menke
    Jan 24 at 22:53

















Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

– Tony Tan
Jan 24 at 20:42





Thanks for the quick fix. I messed up the spelling for foreach. But the curly bracket was the devil!

– Tony Tan
Jan 24 at 20:42




1




1





@TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

– Henri Menke
Jan 24 at 20:56





@TonyTan You can also leave out the braces around #2, but then you have to use trigram{0}{{b,w,w}};

– Henri Menke
Jan 24 at 20:56













@marmot Sorry but I no longer waste my time drawing other people's pictures.

– Henri Menke
Jan 24 at 22:53





@marmot Sorry but I no longer waste my time drawing other people's pictures.

– Henri Menke
Jan 24 at 22:53


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471722%2fundefined-control-sequence-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?