Tag Info

New answers tagged

1

Works only for integer of semi integer values. \documentclass{report} \usepackage{tikz} \newcommand{\grade}[1]{% \begin{tikzpicture} \clip (1em-.3em,-.3em) rectangle (5em +.5em ,.3em); \begin{scope} \clip (1em-.3em,-.3em) rectangle (#1em +.5em ,.3em); \foreach \x in {1,2,...,5}{ \path[fill=red] (\x em,0) circle (.25em); } \end{scope} \foreach \x in ...


1

It looks... well... basically, awful in my opinion but anyway... \documentclass[tikz, border=15]{standalone} \usetikzlibrary{decorations.text} \usepackage[nopar]{lipsum} \UnpackLipsum[1] \begin{document} \tikz\draw [gray, thick, postaction={decoration={text along path, text/.expanded=\lipsumexp}, decorate}] (0,0) \foreach \i in {0,...,20}{ -- ...


3

Here is a non-package solution. It lists the found letters in alphabetical order. It also works fine with pdftex and any traditional 8bit encoding. Not designed for Unicode ! Make sure to save the code sample in iso-latin-1 encoding (automatic if you copy paste to an Emacs buffer due to the magic line at top). % -*- coding: latin-1; -*- % Time-stamp: ...


6

This is a Lua snippet with some CJKV characters in the strings. I've selected an opentype font from TeX Live, but it doesn't contain some diacritical letters (e.g. č, ř and š), let me hope it is sufficient as a demonstration of handling UTF-8 strings. We run lualatex mal-letters.tex. % lualatex mal-letters.tex \documentclass[a4paper]{article} ...


5

With expl3 and l3regex: \documentclass{article} \usepackage{xparse,l3regex} \ExplSyntaxOn \NewDocumentCommand{\countchar}{mm} {% #1 = character, #2 = string \youra_count_char:nn { #1 } { #2 } \int_to_arabic:n { \l_youra_count_char_int } } \NewDocumentCommand{\countallchars}{m} {% #1 = string \youra_count_all_chars:n { #1 } } \int_new:N ...


6

It is easy to program with xstring (with no unuseful test): \documentclass{extarticle} \usepackage{xstring} \newcommand\fios{hellow world} \newcommand\occurs[1]{% \ifhmode\par\fi\begingroup\expandarg \StrDel{#1}{ }[\tempstr]% \occuraux\endgroup } \newcommand\occuraux{% \unless\ifx\tempstr\empty ...


3

Here, using stringstrings package, I provide two versions: one that counts it alphabetically (\countstring), and the next that counts in the order of appearance (\Countstring). \documentclass{article} \usepackage{stringstrings} \def\countstring#1{% \caselower[q]{#1}% \testchar{\thestring}{a}\testchar{\thestring}{b}\testchar{\thestring}{c}% ...


5

This is quite tricky to do because feynmf does not provide an easy way to fill an arbitrary cycle of paths, nor an easy interface to the paths it has created for you. You could draw a polygon and shade that, but then you'd have trouble putting the arrows on the side of it. Faced with this level of complexity, it's usually easier to draw your diagram in raw ...


12

With no package, only classical TeX: \newcount\tmpnum \def\myscale#1#2{% \tmpnum=#1 \the\tmpnum \loop \ifnum\tmpnum<#2 \advance\tmpnum by1 \quad\the\tmpnum \repeat } Using eTeX extension and axpandable solution: \def\myscale#1#2{#1% \ifnum#1<#2 \space ...


1

You don't need pstricks for that. Here is a very simple code that reproduces your image, and which can be inserted in pstricks code: \documentclass{article} \usepackage{multirow} \newcommand\Bucler[3]{% \ensuremath{\begin{array}{|c|c|} \hline #1 &\multirow{2}{*}{\ensuremath{#3}}\\ \cline{1-1} #2&\\ \hline \end{array}} } \begin{document} ...


8

Here's a LuaLaTeX-based solution. The two arguments of \myscale can be any expressions that evaluate to numbers under TeX's and Lua's combined rules. If the macro's second argument is smaller than the first, nothing is printed. % !TEX TS-program = lualatex \documentclass{article} \newcommand{\myscale}[2]{\directlua{% for i = #1, #2 do tex.print(i) ...


6

Just for kicks, with expl3/xparse: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \cs_new_protected:Npn \alain_range:nnN #1#2#3 { \seq_clear:N #3 \int_set:Nn \l_tmpa_int { #1 } \int_set:Nn \l_tmpb_int { #2 } \int_while_do:nNnn \l_tmpa_int < \l_tmpb_int { \seq_push:NV #3 \l_tmpb_int \int_decr:N \l_tmpb_int } \seq_push:NV #3 ...


7

Using \whiledo of package ifthen: \documentclass{article} \usepackage{ifthen} \newcounter{mycount} \newcommand{\myscale}[2]{ \setcounter{mycount}{#1} \whiledo{\value{mycount}<#2} {\arabic{mycount}, \stepcounter{mycount}}% \arabic{mycount}.} \begin{document} \myscale{1}{6}\par \myscale{-4}{4} ...


10

With no package (but requiring e-TeX), a fully expandable solution: \documentclass{article} \makeatletter \newcommand{\myscale}[2]{% \ifnum#1=#2 $#1$\expandafter\@gobble \else \expandafter\@firstofone \fi {\myscale@aux{#1}{#2}}% } \newcommand{\myscale@aux}[2]{% \ifnum#1>#2 \expandafter\@firstoftwo \else ...


7

interesting question, you can do this : \documentclass{article} \usepackage{pgffor} \newcommand{\myscale}[2]{% \foreach \index in {#1,...,#2}{\index\space\space}% } \begin{document} \myscale{1}{6} \myscale{9}{17} \end{document}



Top 50 recent answers are included