1

I have a noisy, colorful background, and I am writing text into it. The problem is that depending on the background color, part of the text is difficult to read. This is a TeXified question of this other question from graphicdesign.SE.

Here is (the same) picture (originally taken from here). Now if I use this, as a background (london3.png) in the following MWE (thanks to suggestions from Christian Hupfer it is now much cleaner):

\documentclass[a4paper,landscape]{article}
\usepackage[outline]{contour}
\usepackage{background}
\usepackage{eso-pic}
\backgroundsetup{contents={}}

\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\includegraphics[
width=\paperwidth,
keepaspectratio%,
]{london3.png}}%
}}      
\newcommand{\fancytext}[1]{\textcolor{white}{\contour{black}{\textbf{#1}}}}

\begin{document}
\AddToShipoutPicture*{\BackgroundPic}
\sffamily
\Huge
\vspace*{3cm}
\noindent\scalebox{3}{\fancytext{This is a longgg text which is difficult to read on this background.}}
\noindent\scalebox{3}{\fancytext{This s anothhhher long text which is difficult to read.}}  
\end{document}

Then I end up with something like this:

enter image description here

This is rather unpleasant. To improve this text, I would like to

  1. apply a semi-transparent background, as shown here surrounding the text (but keeping the vivid background otherwise); and
  2. fix the g-h phenomenon.
Matsmath
  • 936
  • Your 'MWE' is a little bit noisy too (;-) ), but the Draft stuff vanishes by using \backgroundsetup{contents={}} –  Jun 02 '16 at 15:00
  • @ChristianHupfer thanks to your comment, I have removed some noise. – Matsmath Jun 02 '16 at 15:11
  • background is tikz-related picture, transparent interferes with tikz opacity settings, so loading both can lead to problems –  Jun 02 '16 at 15:16
  • Apparently, that was necessary for the photo caption. – Matsmath Jun 02 '16 at 15:21
  • 1
    by the "g-h" phenomenon, i believe you mean the fact that the descenders of the"g" overlap the ascenders of the "h". the easiest way i can think of doing that is to add a small bit of vertical space between the lines. since that will push down the second line, it would probably be advisable to decrease the vertical space at the top. – barbara beeton Jun 02 '16 at 15:24
  • @barbarabeeton actually my intentions would be to write multi-line paragraphs with correct spacing. However, the \fancytext macro does not allow linebreaks, perhaps because of limitations of the contour package. – Matsmath Jun 02 '16 at 15:27
  • in that case, you want to reset the baselines to accommodate the enlarged size of the text. that's best done with \fontsize ... \selectfont (see Controlling the spacing between lines with \fontsize{}{}\selectfont, remembering always to end the text with \par or a blank line.) – barbara beeton Jun 02 '16 at 15:31
  • The transparency can be achieved with tikz, but the contour breaks actually –  Jun 02 '16 at 15:34
  • Using contoured text was the first suggestion (from the graphics design post) to improve readability. I find it really useful. – Matsmath Jun 02 '16 at 15:37

1 Answers1

1

A preliminary solution, working for the transparency so far only`.

\documentclass[a4paper,landscape]{article}
\usepackage[outline]{contour}
\usepackage{xcolor}
\usepackage{graphicx}
%\usepackage{transparent}
\usepackage{background}
\usepackage{eso-pic}
\newcommand\BackgroundPic{%
  \includegraphics[%
  width=\paperwidth,
  keepaspectratio%,
  ]{london3.png}
}
% \textheight = 630pt %762pt
% \topmargin=-1.2cm
\oddsidemargin=-2.5cm

\newcommand{\fancytext}[1]{\textcolor{white}{\contour{black}{\textbf{#1}}}}
\backgroundsetup{contents={\BackgroundPic},position={0,0},placement=top,scale=1,angle=0,opacity=0.6}
\begin{document}
\thispagestyle{empty}
\sffamily
\Huge
\vspace*{3cm}
\noindent\scalebox{3}{\fancytext{This is a longgg text which is difficult to read on this background.}}
 \vskip0.5\baselineskip
\noindent\scalebox{3}{\fancytext{This s anothhhher long text which is difficult to read.}}  
\end{document}

Update, but still not really nice

\documentclass[a4paper,landscape]{article}
\usepackage[outline]{contour}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{background}
\usepackage{eso-pic}
\newcommand\BackgroundPic{%
  \includegraphics[%
  width=\paperwidth,
  keepaspectratio%,
  ]{london3.png}
}
% \textheight = 630pt %762pt
% \topmargin=-1.2cm
\oddsidemargin=-2.5cm

\newcommand{\fancytext}[2][]{\begin{tikzpicture} \node[gray,#1] (A) at (0,0) {\contour{black}{#2}};\end{tikzpicture}}
\backgroundsetup{contents={\BackgroundPic},position={0,0},placement=top,scale=1,angle=0,opacity=1.0}
\begin{document}
\thispagestyle{empty}
\sffamily
\Huge
\vspace*{3cm}
\noindent\scalebox{3}{\protect\fancytext[opacity=0.3]{This is a longgg text which is difficult to read on this background.}}
\vskip0.5\baselineskip
\noindent\scalebox{3}{\fancytext[red,opacity=0.3]{This s anothhhher long text which is difficult to read.}}  
\end{document}
  • Still trying to attack the g-h-issue –  Jun 02 '16 at 15:24
  • I see here you added an opacity flag to the background. But I don't want a fade background. I would prefer a vivid background with lively (lovely) colors, which are opaque/transparent/shady only around the text. – Matsmath Jun 02 '16 at 15:25
  • @Matsmath: Sorry, I misread. –  Jun 02 '16 at 15:26
  • see my comment above. (of course, i may have misunderstood exactly how the op interpreted the problem.) – barbara beeton Jun 02 '16 at 15:27
  • @barbarabeeton: Yes, I found it already too, using some \vskip, for example –  Jun 02 '16 at 15:28