Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I try to do a little more spectacular that phrase ( Δελτιο Υλης) . Is the headline on a press material for my students. The fact is that I could accomplish this with gimp or a graphics program such as the inscape or similar programs.

But what I want is to make a somewhat artistic distortion of letters through tikz to show to my students the possibilities of having the LaTeX without using external programs.

My question: is there a way to warp letter and how?

Currently this is what I've done ... and certainly I have not artistic vein ...

enter image description here

\documentclass[b5paper,svgnames,10pt]{book}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\usepackage{color}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\draw[grid,step=0.5cm,gray,very thin] (-1cm,-1cm) grid (9cm,1.5cm);
\node[scale=5.,color =MidnightBlue ] at (0,0) {$\Delta$};
\node[scale=5.,color =MidnightBlue ,rotate=30] at (0.84cm,0.1cm) {$\varepsilon$};
\node[scale=5.,color =MidnightBlue,rotate=-15 ] at (1.3cm,0.0cm) {$\lambda$};
\node[scale=5.,color =MidnightBlue,rotate=+15 ] at (1.95cm,-0.2cm) {$\tau$};
\node[scale=5.,color =MidnightBlue ] at (2.5cm,0) {$\iota$};
\node[scale=5.,color =MidnightBlue ] at (2.6cm,0.4cm) {$'$};
\node[scale=5.,color =MidnightBlue ] at (3.0cm,0) {$o$};
\node[scale=6.,color =MidnightBlue,rotate=-20 ] at (5.3cm,0.08cm) {$\Upsilon$};
\node[scale=5.,color =MidnightBlue ] at (6.cm,-0.2cm) {$\lambda$};
\node[scale=5.,color =MidnightBlue ] at (7.cm,-0.1cm) {$\eta$};
\node[scale=5.,color =MidnightBlue ] at (8.cm,0) {$\varsigma$};
\end{tikzpicture}
\end{document}
share|improve this question
11  
I would use MS Word for this. It's naturally supported –  percusse Mar 29 '13 at 23:06
5  
Did you see one of our greatest questions about Ctulhu and random rotations of letters here tex.stackexchange.com/q/29402/3235 ? Or any other great answers on this site ? –  percusse Mar 29 '13 at 23:11
1  
@karathan: Looks like a CAPTCHA to me. Maybe it would make sense to rename the question to accommodate that? –  Count Zero Mar 29 '13 at 23:18
4  
Maybe I should add that I meant the terrible quality of Word math rendering that it comes this horrible by default if one uses Word. –  percusse Mar 30 '13 at 15:33
2  
Why limit the question to TikZ? (see Why Metapost discrimination) –  Aditya Mar 30 '13 at 17:12
show 6 more comments

3 Answers

up vote 37 down vote accepted

No claims to artistry or anything (you may, or may not notice that I've changed the text :-), also as it involves randomness sometimes it looks OK sometimes it does not:

\documentclass{standalone}
\usepackage{tikz}

\pgfmathdeclarerandomlist{fonts}{{\bf}{\tt}{\rm}{\sf}{\it}{\sl}}

\tikzset{
    distort/.style={
        rotate=rand*10, 
        yslant=rand/3, 
        xslant=rand/3, 
        xscale=1+rand/4,
        yscale=1+rand/4,
        execute at begin node={%
            \pgfmathrandomitem{\newfont}{fonts}\newfont%
        }
    }
}

% Need a special space because inside \node { };
% \ignorespaces and \unskip will remove spaces.
\def\bigspace{\hbox to 1ex{\hfil}}

\begin{document}

\Huge

\begin{tikzpicture}

% The basic idea is to create a node called 0
% then by maintaining indexes \i = 1,2,... and \j = 0,1,...
% it is possible to position the current node (called \i)
% to the previous node (called \j).
\coordinate (0);
\foreach \letter [count=\i, count=\j from 0]in {P,i,g,s, \bigspace  ,m,i,g,h,t, \bigspace ,f,l,y}
    \node [inner sep=0pt, anchor=base west, distort]  at (\j.base east) (\i)
        {\pgfmathrandomitem{\newfont}{fonts}\newfont\letter};

\tikzset{yshift=-0.75in}


% The opacity is stored in an array and accessed
% using the (undocumented) evaluate key.
\foreach \c [evaluate={\o={5,25, 100}[\c-1];}]in {1,...,3} {
    \coordinate (0) at (rand/4, rand/4);
    \foreach \letter [count=\i, count=\j from 0]in {P,i,g,s, \bigspace  ,m,i,g,h,t, \bigspace ,f,l,y}
        \node [inner sep=0pt, anchor=base west, black!\o, distort]  at (\j.base east) (\i) {\letter};
}

\tikzset{yshift=-0.75in}

% In order to get the same randomness (!) the random seed
% can be set to a fixed value. In this case the value is
% selected from the range 1-32768.
\pgfmathrandominteger\seed{1}{32768}
\foreach \c [evaluate={\o={5,25, 100}[\c-1];}]in {1,...,3} {
    \coordinate (0) at (\c*2pt,\c*2pt);
    \pgfmathsetseed{\seed}
    \foreach \letter [count=\i, count=\j from 0]in {P,i,g,s, \bigspace  ,m,i,g,h,t, \bigspace ,f,l,y}
        \node [inner sep=0pt, anchor=base west, black!\o, distort]  at (\j.base east) (\i) {\letter};
}
\end{tikzpicture}

\end{document}

catchpa

EDIT: Added some more randomness in an attempt to make it more fancy.

share|improve this answer
2  
Really an excellent result. LaTeX and Tikz have a unique way to surprise me!!! and all of you with your codes –  karathan Mar 31 '13 at 14:00
    
If you find a little time, would be easy to put a short comment on each line to explain your code –  karathan Mar 31 '13 at 18:52
    
Is there any way to get the text that is displayed to make it an actual captcha? (Sorry, TeX n00b) –  Cole Johnson Apr 5 '13 at 19:49
add comment

Here is a solution that uses Metapost and ConTeXt (no font changes but randomized color and scaling):

\starttext
\startMPpage[offset=3mm]

picture lab;

numeric total_width, current_width;

total_width := 0;

for s = "H", "e", "l", "p", "\quad", "Γ", "Δ" :
   lab := textext(s); 
   current_width := xpart (lrcorner lab - llcorner lab);

  for i = 1,3,2 :
   draw lab  rotated (-30 randomized 60) shifted (total_width randomized 5pt, i*6pt randomized 2pt)
      if i = 1 :
        scaled (0.8 randomized 0.2)
        withcolor (0.8 randomized 0.1, 0.8 randomized 0.1, 0.8 randomized 0.2)
      elseif i = 2 :
        scaled (0.8 randomized 0.2)
        withcolor (0.2 randomized 0.1, 0.1 randomized 0.1, 0.8 randomized 0.2)
      else :
        scaled (0.8 randomized 0.2)
        withcolor (0.8 randomized 0.1, 0.8 randomized 0.1, 0.8 randomized 0.2)
      fi;
  endfor

   total_width := total_width + current_width ;
endfor


\stopMPpage

\stoptext

which gives

enter image description here

share|improve this answer
    
something went wrong as all three colors are light. One of them (in the middle) is supposed to be dark. –  Aditya Mar 31 '13 at 5:03
    
No, context filename is correct. But the colors are changed at random, so there is no way to predict the output. –  Aditya Mar 31 '13 at 5:12
    
Hmm... strange. I uploaded a bigger picture. –  Aditya Mar 31 '13 at 5:29
    
Yes. Indeed. I might try to re-install ConTeXt. Well, thanks for the answer. This is really helpful. +1 :) –  hpesoj626 Mar 31 '13 at 5:32
    
Although I use LaTeX + Tikz... is a very good result and will be useful to users of Metapost and ConTeXt –  karathan Mar 31 '13 at 14:07
show 4 more comments

Without PSTricks.

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage[a0paper]{geometry}
\usepackage[nomessages]{fp}
\usepackage{graphicx}
\usepackage{pgffor}
\FPseed=0
\begin{document}
\foreach \C in {I,a,m,a,p,i,g,.}{%
    \FPrandom\Scale\FPeval\Scale{round(Scale*10+1:2)}
    \FPrandom\Rotate\FPeval\Rotate{round(Rotate*1000:2)}
    \FPrandom\Raise\FPeval\Raise{round(Raise*10:2)}
    \scalebox{\Scale}{\rotatebox{\Rotate}{\raisebox{\Raise pt}{\C}}}%
}%
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.