6

I'm a complete newbie to Latex, and I am trying to use it for creating small pdf images with equations. My requirements are:

  • Aligned equations
  • Clear font (bold and italic)
  • Minimal sized image in PDF format
  • Searchable in PDF format

This version finally creates a small PDF without margins, but the problem I run into is with searching. For some fonts, I can't search for comma (in case I want to find "x,y". In some versions, the first letter of a word isn't searchable with the rest of the word, so "Sample" is not searchable. In some fonts, I can't search for a word ending in ff, the second f is not searchable. Is there an easy solution to this?

To create the file:

pdflatex --file-line-error --interaction=nonstopmode testcode.tex

Thank you so much!

\documentclass{amsart}
\usepackage{txfonts}
\usepackage[T1]{fontenc}
\usepackage[margin=0pt]{geometry}
\usepackage[active,tightpage]{preview}
\usepackage{varwidth}
\begin{document}
\begin{preview}
\begin{varwidth}{\linewidth}
\begin{equation}
\nonumber
\begin{aligned}
&Example\_VAL_{x,y} &&= \sum\nolimits_{i=0}^{MARK\_n}VAL_{x,y,i} * VAL_i
\\
&Example\_VAL2_{x,y} &&= \sum\nolimits_{i=0}^{MARK\_n}VAL2_{x,y,i} * VAL_i
\end{aligned}
\end{equation}
\end{varwidth}
\end{preview}
\end{document}

Latest version after help from Ulrike, and trying to simplify code writing for myself:

\documentclass[varwidth=\maxdimen,border=2pt]{standalone}
\usepackage{luatex85}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage[italic]{mathastext}
\setmainfont{TeX Gyre Termes} %Times clone
\setmathfont{TeX Gyre Termes Math} %accompagning math.

\begin{document}
\[
\nonumber\begin{aligned}
        &Example\_VAL_{x,y} &&= \sum\nolimits_{i=0}^{MARK\_n}VAL_{x,y,i} * VAL_{i}
        \\
        &Example\_VAL2_{x,y} &&= \sum\nolimits_{i=0}^{MARK\_n}VAL2_{x,y,i} * VAL_{i}
    \end{aligned}
\]
\end{document}

Curious how to get a slanted more normal font in the equation - without embedding myvar throughout.

3

If you want searchable math you should better use one of the unicode engines (lualatex or xelatex). With pdflatex it would involve a lot juggling with accsupp.

And if you have long "Textvariables" then better set them with the text font. Beside this I would suggest to use the standalone class.

\documentclass[varwidth,border=2pt]{standalone}
\usepackage{luatex85}
\usepackage{amsmath}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes} %Times clone
\setmathfont{TeX Gyre Termes Math} %accompagning math.
\newcommand\myvar[1]{\text{\normalfont\itshape #1}}
\begin{document}
\[
\nonumber
\begin{aligned}
&\myvar{Example\_VAL}_{x,y} &&= \sum\nolimits_{i=0}^{\myvar{MARK\_n}}\myvar{VAL}_{x,y,i} * \myvar{VAL}_i
\\
&\myvar{Example\_VAL2}_{x,y} &&= \sum\nolimits_{i=0}^{\myvar{MARK\_n}}\myvar{VAL2}_{x,y,i} * \myvar{VAL}_i
\end{aligned}
\]
\end{document}

enter image description here

  • Thanks for the quick answer. After creating the PDF, the character 'x' is missed in the x,y. So when I search for x, I get the 'x' in example but not the x in the subscript. I've tried using Adobe Acrobat and MacOS Preview. Any way to get all characters and words to be searchable? – nachum Apr 23 '17 at 15:11
  • The x in text (Unicode U+0078) is a quite different char then a mathematical 𝑥 (U+1D465). – Ulrike Fischer Apr 23 '17 at 16:18
  • How do I use the 'x' from text and not math? – nachum Apr 23 '17 at 19:41

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.