4

I have this code:

\documentclass[twoside,fleqn]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{fadings,decorations.text}
\usetikzlibrary{patterns}
\begin{document}
 \begin{tcolorbox}
    \begin{tikzfadingfrompicture}[name=tikz]
    \node[text width=15cm,text=transparent!20]{\fontsize{35}{60}\bfseries My title\\};\end{tikzfadingfrompicture}
    \begin{tikzpicture}
    \node[text width=15cm-3mm,text opacity=0,shade, path fading=tikz,
    fit fading=false,
    top color=red,
    bottom color=yellow]{\fontsize{35}{40}\sffamily\bfseries My title\\};
    \end{tikzpicture}
    \end{tcolorbox}
\end{document}

Now I wanted to add a black edge and a shadow to the text, how can I do? The following is an example. Sample image

  • In addition to completing the code, could you clarify what you are trying to do? You say you want to add an edge. Then you say you want to get rid of an edge between the grey and black. But there's nothing between the grey and black, is there? If I complete your code in a standard way, the result is nothing like the picture you've posted. – cfr Apr 26 '16 at 21:00
  • I don't believe tikz is geared up for font effects. First you would have to create a "font" of tikz shapes, then apply all the usual tricks to these shapes. – John Kormylo Apr 26 '16 at 21:15
  • there is another edge in the image but I don't want it. check closely. – Francesco Apr 27 '16 at 11:50
5
\documentclass{article}
\usepackage{tikz}
\usepackage{pdfrender}
\usepackage{xcolor}

\begin{document}

\begin{tikzpicture}

\node[opacity=.2] at (0.1,-0.1) {
            \scalebox{2}{\texttt{%
\textpdfrender{%
  TextRenderingMode=2,
  LineWidth=.1ex,
  StrokeColor=darkgray!50,
  FillColor=darkgray!50,
}{\Huge Hello World}}} 
};
\node at (0,0) {
 \scalebox{2}{\texttt{%
    \textpdfrender{%
      TextRenderingMode=2,
      LineWidth=.1ex,
      StrokeColor=blue!30!black,
      FillColor=orange!90,
    }{\Huge Hello World}}} 
};

\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Worked great for me! Thanks a lot. However, I would use \node [font=\ttfamily,scale=2] at (0,0) {\textpdfrender{... instead of the \scalebox and \texttt. – Martin Scharrer Jan 31 at 12:03
  • @MartinScharrer Good point Martin, you're right. I hope to have enough strength soon to program a little again – Alain Matthes Feb 1 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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