0

This question already has an answer here:

I'm compiling this code with XeLaTeX:

\documentclass[11pt]{article}
\usepackage{graphicx}
\begin{document}
    This text is blurry if there is an image.
    \includegraphics{Test.png}
\end{document}

where the image I'm including is:
Image

If I comment out the \includesgraphics, I get:

Clear

If I don't, I get:

Blurry

Why does the text look different (in my eyes, blurrier) when there is an image on the screen?
How can I prevent this from happening in XeLaTeX?

marked as duplicate by yo', David Carlisle, jubobs, percusse, Martin Schröder Sep 22 '13 at 23:30

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.

  • 2
    The PNG file contains an alpha channel for transparency. Remove this channel with the image manipulation software of your choice. Actually this effect shouldn't occur anymore but seems to depend on the used PDF viewer. – Thorsten Donig Sep 22 '13 at 19:58
  • @ThorstenDonig: I just tried that, and it didn't help. But even if it had, I wouldn't want to remove the alpha channel... – Mehrdad Sep 22 '13 at 20:02
  • @ThorstenDonig: Also I'm not sure what you mean by it "shouldn't occur anymore"... I have a recent version of Acrobat (10) and a recent version of MiKTeX (2.9) so it's not because I'm using old software... – Mehrdad Sep 22 '13 at 20:10
  • @JosephWright: No, they're arbitrary PNGs. Honestly, I'm not trying to figure out how to draw vectors in LaTeX, I'm not trying to find the right Unicode character for a star... it's not that complicated :) I'm trying to figure out how to prevent the includion of an arbitrary image from making the text look different. – Mehrdad Sep 22 '13 at 21:22
  • @Mehrdad Which viewers/platforms did you try? XeLaTeX, along with other TeX engines, more-or-less just copies images directly into the output. As such, problems with the appearance of PDFs often come down to the viewer(s) involved. – Joseph Wright Sep 22 '13 at 21:23
6

There is no need to use a bitmap image for the symbol. It is the Unicode character ☆:

U+2606 WHITE STAR

LuaTeX

Even with bold fonts, the symbol does not have the thickness of the lines usually. This can be manipulated by package pdfrender that works for pdfTeX/LuaTeX in PDF mode. Example:

\documentclass{article}
\usepackage{fontspec}
\usepackage{pdfrender}

\newcommand*{\mysymbfont}{%
  \fontspec{\myfont}%
  \fontsize{5em}{5em}\selectfont
}
\newcommand*{\textbigwhitestar}{^^^^2606}

\begin{document}
  \tabcolsep=.2\tabcolsep
  \begin{tabular}{llll}
    \xdef\myfont{DejaVuSans-Bold.ttf}%
      \texttt{\myfont}:
    &
      \mysymbfont
      \textbigwhitestar
    & \mysymbfont
      \textpdfrender{
        TextRenderingMode=Stroke,
        LineJoinStyle=Round,
        LineWidth=.5pt,
      }{\textbigwhitestar}
    & \mysymbfont
      \textpdfrender{
        TextRenderingMode=FillStroke,
        LineJoinStyle=Round,
        LineWidth=2pt,
      }{\textbigwhitestar}
    \\
    \xdef\myfont{xits-math.otf}%
      \texttt{\myfont}:
    & \mysymbfont
      \textbigwhitestar
    & \mysymbfont
      \textpdfrender{
        TextRenderingMode=Stroke,
        LineJoinStyle=Round,
        LineWidth=.5pt,
      }{\textbigwhitestar}
    & \mysymbfont
      \textpdfrender{
        TextRenderingMode=FillStroke,
        LineJoinStyle=Round,
        LineWidth=1pt,
      }{\textbigwhitestar}
  \end{tabular}
\end{document}

Result

XeTeX

In XeTeX the symbol can be included as PDF file, generated via LuaTeX, e.g.:

% whitestar-raw.tex for LuaLaTeX
\documentclass{article}
\usepackage{fontspec}
\usepackage{pdfrender}
\pagestyle{empty}

\begin{document}
  \fontspec{DejaVuSans-Bold.ttf}
  \fontsize{5em}{5em}\selectfont
  \textpdfrender{
    TextRenderingMode=FillStroke,
    LineJoinStyle=Round,
    LineWidth=2pt,
  }{^^^^2606}
\end{document}

Then compile it and crop the margins:

lualatex whitestar-raw
pdfcrop whitestar-raw.pdf whitestar.pdf

whitestar

In XeTeX the PDF file is included via:

\includegraphics{whitestar}
  • 2
    Summarising removed comments: The question is about a general problem, in that adding images such as the example given results in 'blurry' text. As such, this answer doesn't address the key problem for the questionner, as the star was only an example. – Joseph Wright Sep 23 '13 at 7:21

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