Tag Info

New answers tagged

1

Here another approach using the pic-environment (available since pgf 3.0). I got two code examples using even/odd or custom positions for the yellow circles. This way the elements are predefined and can easily be reused in the \foreach statement. The code should be self-explanatory, in doubt just ask. Info: The both examples just differ in the ...


2

I think an easy approach is to use a matrix of nodes to draw the initial table. This automatically asigns a name to each cell, in the form matrix_name-Row-Column so it is easy to later add the circle via a loop. \usetikzlibrary{matrix} \begin{tikzpicture} \tikzset{ cell/.style = {inner sep=2pt, minimum width=2em, minimum height=2em, draw} } \matrix[matrix ...


4

Previous note: Please, next time provide a COMPLETE minimal working (or not) example: starting from \documentclass... and finishing with \end{document} with all libraries and personal functions you use to test your code. Answer: I'm not sure about what you want to do but if you just want to add some filled circles to previous defined nodes you can do it ...


6

Just absorb the mandatory argument and “remember” it: \makeatletter \newcommand{\foo}[1]{% \@ifnextchar[{\foo@aux{#1}}{\foo@aux{#1}[default]}% } \def\foo@aux#1[#2]{% mandatory is `#1', optional is `#2'% } \makeatother of course this is not very robust and \DeclareRobustCommand should be used. A syntax like \foo{a}[b]{c} where the optional argument ...


4

This solution creates a file \jobname.use which tracks, which commands have been used. You add a command to the list by doing \ifused\<command>{<hook>}. In the example I used \patchcmd from etoolbox to remove \bfseries from \l@chapter. Doing \ifused twice for the same command will produce errors. \documentclass{book} \usepackage{xparse,etoolbox} ...


4

The existence of a (LaTeX) counter can be tested with \@ifundefined{c@<argument>}: \newcommand\andrea@test@count[1]{% \@ifundefined{c@#1} {% the counter doesn't exist \newcounter{#1}\setcounter{#1}{1}% } {% the counter exists \stepcounter{#1}% }% } Full example \documentclass{article} % \makeatletter ...


7

I would set up one wrapper .tex file for each variant. This should contain only those things from the preamble which you need to change. Everything else goes in the main .tex file so that you do not need to worry about keeping things in sync when you make modifications to the content. Then \input the main file. For example: %% diss-1.tex ...


4

ConTeXt solution \def\repeatstring#1#2{\edef\concathere{\dorecurse{#1}{#2}}} \starttext \repeatstring{5}{abc}\concathere \stoptext


7

Repetition via \romannumeral trick The number is multiplied with 1000 to convert it to a roman number. Then TeX produces a long string consisting of letter m, whose length is the original number. Then \repeatstringX looks at the next token, if it is an m, then the string unit is output. Otherwise the next token is the end marker F and the loop stops. ...


8

There are various ways to accomplish your needs. \documentclass[11pt]{article} \usepackage{xparse} % for D % for A, B, C \newcounter{mycount} \makeatletter \newcommand\repeatstringA[2]{% \setcounter{mycount}{#1}% \ifnum\themycount>0 #2% \addtocounter{mycount}{-1}% \expandafter\@firstofone \else \expandafter\@gobble \fi ...


1

I think the comment-environment of the verbatim package is what you are searching for. Here is an example how to define myenv according to your requirements. \documentclass{article} \usepackage{verbatim} \newif\ifshow \newenvironment{myenv}% {\ifshow\expandafter\verbatim\else\expandafter\comment\fi}% ...


5

Here, I set up a recursive loop. Works with macros, too. \documentclass[11pt]{article} \newcounter{mycount} \def\repeatstring#1#2{% \setcounter{mycount}{#1}% \ifnum\value{mycount}>0\relax#2% \addtocounter{mycount}{-1}% \repeatstring{\value{mycount}}{#2}% \fi% } \begin{document} \repeatstring{5}{abc} \repeatstring{3}{\today} \end{document} ...


5

You are misunderstanding how the logical <expression> should be given. The result should be 'logically true', not the text true: \documentclass{article} \usepackage{etoolbox} \newcounter{countdown} \newcommand\concathere{} \newcommand\repeatstring[2]{% \setcounter{countdown}{#1}% \renewcommand\concathere{}% \whileboolexpr {test ...


9

Of course, the version number can be checked, but it is not so trivial, because the numbering scheme has changed in the past several times. I think, it is easier to check for the feature, whether \pdfsuppresswarningpagegroup is defined: \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname ...


2

You can collect the cell entry using collcell and condition on it's value with a basic \ifnum TeX condition: \documentclass{article} \usepackage{collcell,array,xcolor} \newcommand{\formatcolentry}[1]{% \ifnum#1<10 \color{red}% \else\ifnum#1>30 \color{green}% \fi\fi#1} \begin{document} ...


1

I identified a working strategy that solves part of the problem. The common useage of this command is "\rput[refpoint]{rotation}(x,y){stuff}". "refpoints" determines the reference point of stuff. It take value of the combination of "t,b,B"(for vertical refpoint, means "top","bottom" and "Baseline" respectively) and "l,r"(for horizontal refpoint, means ...



Top 50 recent answers are included