BartoszMilewski / Publications

Misc. publications, conference slides, etc. For more, go to http://BartoszMilewski.com
1.24k stars 38 forks source link

Typesetting highlights should cover the space below the letters #17

Closed clehene closed 2 months ago

clehene commented 2 months ago

Hey - small nitpick for how the PDF is rendered. Note that when highlighting text, the space below the letters is not covered.

Dao of FP Dao FP

CT in context CT in context

BartoszMilewski commented 2 months ago

I wish I knew how to fix it. I'm using TeXShop to edit LaTeX and produce the PDFs.

clehene commented 2 months ago

Below this line is what GPT responded


When using TeXShop, which typically relies on pdflatex for PDF generation, the issue may be related to the specific LaTeX packages and commands you're using for highlighting. Here are more specific steps to ensure proper text highlighting in TeXShop:

Using the soul Package for Highlighting

  1. Include the soul package: Add this to the preamble of your LaTeX document.

    \usepackage{soul}
    \usepackage{xcolor}
    \sethlcolor{yellow}  % or any color you prefer
  2. Highlighting Text: Use the \hl command provided by the soul package to highlight text.

    \hl{This text will be highlighted properly.}

Example Document

Here’s a minimal working example that you can use in TeXShop to ensure proper highlighting:

\documentclass{article}
\usepackage{soul}
\usepackage{xcolor}
\sethlcolor{yellow}  % Set the highlight color

\begin{document}

This is normal text.

\hl{This text is highlighted and should appear correctly.}

\end{document}

Troubleshooting

  1. PDF Viewer: Ensure that you are using a PDF viewer that supports proper rendering of highlights. Some PDF viewers might not render the layered text and highlights correctly.

  2. TeXShop Preferences: Ensure that TeXShop is set up to use pdflatex or another appropriate engine that supports the soul package correctly.

    • Go to TeXShop -> Preferences.
    • Under the Typesetting tab, ensure that pdflatex is selected as the default command.
  3. Check for Conflicts: Ensure there are no conflicting packages or settings in your LaTeX document that might affect text rendering.

  4. Font and Encoding: Sometimes, specific fonts or encoding settings can cause rendering issues. Ensure that your document uses standard fonts and encoding settings.

Advanced Settings

If you still encounter issues, consider using xelatex or lualatex, which often provide better support for advanced text rendering features:

% For XeLaTeX
\documentclass{article}
\usepackage{soul}
\usepackage{xcolor}
\sethlcolor{yellow}

\begin{document}

This is normal text.

\hl{This text is highlighted and should appear correctly.}

\end{document}

In TeXShop, you can change the typesetting engine by selecting XeLaTeX from the drop-down menu before compiling the document.

Summary

These steps should help you achieve the correct highlighting behavior in your LaTeX documents when using TeXShop.

clehene commented 2 months ago

I just realized that the tex files are online too (https://github.com/BartoszMilewski/DaoFP) so, perhap, this would be better directed there. With some building instructions, I'd be happy to try that out myself and report back.

clehene commented 2 months ago

Can't reproduce this locally. I suspect is something related to your build environment. Closing