Tag Info

New answers tagged

3

Here's a LuaLaTeX-based solution. It defines a Lua function, called hidedelims, that extracts the material surrounded by the delimiters " {L" and "L} ", and it sets up two LaTeX macros, called \switchon and \switchoff, that enable and disable the operation of the Lua function. The term "whitespace" is understood in its generic sense, i.e., to comprise not ...


2

You can replace "{L " by \hideBEG and " L}" by \hideEND by encTeX's primitive \mubyte. Then the removing the argument is a simple TeX task: \mubyte\hideBEG {L \endmubyte % "{L " -> \hideBEG \mubyte\hideEND \space\space L}\endmubyte % " L}" -> \hideEND \newcount\switch \switch=0 \ifnum\switch>0 \def\hideBEG #1\hideEND{\unskip} ...


4

Control sequence approach As far as you asked about a macro here is a solution using delimited arguments (similar to @jfbu's solution) with a canonical macro introduced through the escape character \, that incorporates your syntax design: \documentclass{article} \newcount\switch \switch=0 \def\maybehide#1{\maybehidei#1} \def\maybehidei L #1 ...


3

The simplest is to use the concept of delimited macros: this is not widely documented in LaTeX manuals, but LaTeX is built upon the TeX macro language which allows this functionality. However doing exactly as you want would be problematic (we don't want to change the catcode of the braces), thus, if you accept to delimit the optional part in the following ...


5

As a single path: \documentclass[tikz,border=5]{standalone} \begin{document} \tikz\draw (0,0) \foreach \i in {3,...,10} \foreach \j in {1,...,\i}{ -- ++(360/\i*\j:1) }; \end{document}


3

As I understand the question, all the polygons should have the same side and should sit on a common base. Here's how to easily do it. \Multipol{<number>} builds regular polygones of 3,4,...,<number> sides all sitting on a common base. The code: \documentclass[border=4pt]{standalone} \usepackage{tikz} \newcommand\polygon[2][]{ ...


0

A pstricks way, with the pst-poly package: \documentclass[x11names]{standalone} \usepackage{ pst-poly} \usepackage{auto-pst-pdf} \colorlet{color3}{DarkSeaGreen2} \colorlet{color4}{DarkSeaGreen3} \colorlet{color5}{DarkSeaGreen4} \colorlet{color6}{DarkSeaGreen4} \colorlet{color7}{DarkSeaGreen3} \colorlet{color8}{DarkSeaGreen2} \begin{document} ...


3

You can also do this very simply in plain Metapost. My poly_on routine will return the path of an n-sided polygon using the line between points a and b as a base. prologues := 3; outputtemplate := "%j%c.eps"; % return the path of a polygon with n sides % using points a and b as the base vardef poly_on(expr a,b,n) = save s,t,c; pair c; s = 360/n; ...


10

You could use the TikZ polygon shapes in a \foreach loop. Add color and styles as you like. Key points are regular polygon shape of the shapes.geometric library relative positioning of the positioning library remember the last node, using characters a, b, ... for node names using the south anchor for positioning and anchoring at the same base line ...


0

Here's my preliminary solution, which incorporates everything. It doesn't fully work yet, but I'll update it when it does. \documentclass{classnofonts} \usepackage[demo]{graphicx} \usepackage{letltxmacro} \usepackage{atbegshi} \usepackage{ifthen} \usepackage{everypage} \makeatletter \newcount\caption@counter@i \caption@counter@i\z@ ...


1

Here I do a bubble sort (with diagnostics that can be commented). Then I employ the indirect addressing requested by the OP. EDITED to automate necessary initializations. \documentclass{article} \usepackage{ifthen} \expandafter\def\csname macro-1-savedposition\endcsname{12345} \expandafter\def\csname macro-2-savedposition\endcsname{1234} ...


4

\documentclass{article} \usepackage{filecontents,xcolor} \usepackage{luacode} \begin{luacode*} tp = tex.print local questions = {} local answers = {} function file_exists(name) local f=io.open(name,"r") if f~=nil then io.close(f) return true else return false end end function Puzzle ( name ) ...



Top 50 recent answers are included