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.

Possible Duplicate:
Outlined characters

There are many ways how to change whole character color. I want edge color to be different from body color of character. How to do it?

It is possible to make character not from one color? (To make effects like "shadowed" character.)

share|improve this question

marked as duplicate by Harish Kumar, Kurt, Werner, cgnieder, azetina Dec 6 '12 at 3:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I just found effect trough pstricks or tikz, it could help. –  boucekv Dec 5 '12 at 7:49

4 Answers 4

up vote 28 down vote accepted

You can use the contour package for this. If you load it with the outline option, you'll get "proper" outlines (as opposed to several offset copies of your text).

\documentclass{article}
\usepackage[outline]{contour}
\usepackage{amsmath}

\contourlength{.4pt}
\begin{document}
\textcolor{yellow}{\contour{blue}{Some Words}}
\end{document}
share|improve this answer

pst-text (part of the pstricks bundle) has some text-manipulation capability, including turning text into paths:

enter image description here

\documentclass{article}
\usepackage{pst-text}% http://ctan.org/pkg/pst-text
\begin{document}
\pscharpath[linecolor=red,linewidth=.4pt,fillstyle=solid,fillcolor=green]{\Large Some text}
\end{document}

More (illustrative) examples are contained within the pst-text documentation.

share|improve this answer

Another alternative is package pdfrender:

  • It needs pdfTeX or LuaTeX in PDF mode.
  • It works for Type 1 fonts by changing their rendering mode, thus PK fonts or rules are not supported.
  • Paragraphs, line breaks and even page breaks are supported.
  • Works with LaTeX or plain TeX based formats.
  • Available both as switch \pdfrender and as macro \textpdfrender similar to \textcolor.

Example file:

\documentclass{article}
\usepackage{pdfrender}
\usepackage{xcolor}

\begin{document}
\textpdfrender{
  TextRenderingMode=2,
  LineWidth=.05ex,
  StrokeColor=blue!30!black,
  FillColor=orange!90,
}{Hello World}
\end{document}

Result

share|improve this answer
    
Oh, that looks interesting! Three questions: 1. Is there a way to put the stroke behind the text (thick strokes will otherwise drown out the fill colour)? 2. It seems that \pdfrender acts as a switch, changing the drawing style for all text that follows. Is there a way to apply the style only to a selected text segment? 3. Do you see a way of applying the pdfrender style to things like fraction lines (see tex.stackexchange.com/questions/8602/…)? –  Jake Dec 5 '12 at 13:47
2  
@Jake (2) Use \textpdfrender instead of \pdfrender... –  Paul Gaborit Dec 5 '12 at 13:48
    
@Jake Even with \textpdfrender, the effect of clip actions (as TextRenderingMode=7) overflows the given text segment... May be a bug. –  Paul Gaborit Dec 5 '12 at 14:19
1  
@PaulGaborit Thanks, answer fixed. –  Heiko Oberdiek Dec 5 '12 at 14:23
3  
@Jake Ad 1.: You could put the fill variant over the stroke variant. But this looses line and page breaks. Ad 2.: Mistake, fixed, use \textpdfrender. Ad 3.: No, the feature works with glyphs from Type 1 fonts. Other things like rules or PK fonts are not supported. –  Heiko Oberdiek Dec 5 '12 at 14:33

And here comes a ConTeXt example using the effect feature with the outer setting.

\defineeffect
  [outline]
  [alternative=outer,
   rulethickness=3pt]

\starttext

\dontleavehmode
\startcolor [green]%
\hbox to\zeropoint{Hello World!}%
\stopcolor
%
\startcolor [blue]%
\hbox to\zeropoint{%
  \starteffect [outline]%
    Hello World!
  \stopeffect}%
\stopcolor

\stoptext

result

share|improve this answer

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