Cyrillic characters in LaTeX

This one caused some headaches here, so recording the solution in case it’s useful to anyone else.

I wanted to include a Cyrillic string (copied and pasted from an email) in a LaTeX document whose default fonts didn’t support Cyrillic, but when I saved and compiled the file it was replaced by a string of question marks instead. After much poking around and experimentation, and with some assistance from Dave who is even more proficient in LaTeX than I, this solved it:

  1. First off, make sure you’re saving your document in UTF-8. (In WinEdt, this is set under Document > Document Settings… > Format.)
  2. In the document preamble, define the font family for cyrillicfont to one that matches your main package’s font (or that is close enough, but supports Cyrillic):

    \usepackage[utf8]{inputenc}
    \usepackage[T2A,T1]{fontenc}
    \usepackage{polyglossia}
    \setdefaultlanguage{english}
    \setotherlanguages{russian}
    \newfontfamily{\cyrillicfont}{Times New Roman}

  3. In the document body, add your Cyrillic content in the second pair of curly brackets of:

    \foreignlanguage{russian}{}

Adding Headers and Footers to PDFs in Acrobat

Did you know that it’s possible to add headers and footers to a PDF in Acrobat? This is a handy trick if, for example, you’re producing a single document that needs to be branded for multiple end customers, or exporting from Confluence without admin access to set up headers and footers for export on the system.

You can add text headers/footers by editing headers, and add images (for example, logos) by using watermarks. Here are instructions for both in Acrobat X. Continue reading “Adding Headers and Footers to PDFs in Acrobat”

Disappearing Text in PDFs – Part 3

Because I disable commenting on posts a short while after publication (due to insane quantities of spam), this comment was left by Ryan Bernard on an unrelated post, but it’s potentially useful, so bears getting a post of its own:

I read you posts about tables going blank in FrameMaker. The solutions you presented did not work for me. What worked was to use File > Save As PDF and when you get the PDF properties dialog, turn off “Tagged PDFs” settings. I believe this is the little mischief maker we have all been looking for… It worked for me in multiple instances, without fiddling with anything else. I believe Tagging is used for disability presentation or whatever it’s called. Some applications/clients may require that, but most don’t in my experience.

Other possible solutions to this problem are described in these posts:

Disappearing Text in PDFs – Part 2

Following on from a post I wrote a while back on text that was present in the source file, but mysteriously vanished on saving to PDF, here’s a similar incident I encountered with a different resolution.

In this case, again authoring in FrameMake, I was working on a number of reference manuals in the range of 500-800 pages long a piece. All was going well until it came time to publish one of the longer books as a PDF. On checking the generated file to make sure all looked well, I skimmed through quickly. First few pages, fine… next few pages, fine… next few pages, … hang on – what’s that big gap there about?… next few pages, now all the tables are blank!… skip quickly to the end… all that’s left is the header/footer rulings!

Starting over and saving the PDF again gave the same results – in fact, it looked like problems might just be happening earlier and earlier in the document each time.

First port of call was a few “turn it off and back on again”s. First the software, then the whole machine. After a reboot, the same problem kept recurring.

Next stop, fiddling with Acrobat settings, with an occasional reboot for good measure. Still no joy.

A bit of a Google, trying out a few random suggestions, and finally I hit on the solution that worked: delete the font cache (C:\Windows\System32\FNTCACHE.DAT (that’s .DAT – not .dll! Don’t mess with your .dlls or you’ll go blind!)), reboot, save the pdf immediately.

The font cache is regenerated when you reboot, so if the same problem arises again, lather, rinse and repeat.

In the case of the document I was working on, I had to delete the font cache and reboot between every save of the document or text started disappearing again. Depending on the length and complexity of the document you’re working on, your mileage may vary.

Disappearing text in PDFs – Part 1

There’s little more frustrating than finishing writing a lengthy document, with minutes to go to a deadline, clicking Save as PDF with a heavy sigh of relief that everything’s finally done, then opening the final PDF for a last once-over before drawing a line under the project, only to discover that – GAH! – a bunch of text is missing! But it was there the last 20 times you generated draft PDFs! What’s happened?

I’ve had text disappear from PDFs mysteriously twice in the last year, both with different causes and solutions, and I had a heck of a time trying to find a solution both times. This post is on the most recent, and more obscure, problem.

I was working on a FrameMaker document that contained a series of tables of data. All had gone swimmingly through several iterations of the draft document, but when I generated the final PDF for publication, the text from the first cell had disappeared in 80% of the tables. Odd.

I saved again with the same result. Still missing. I rebooted my machine and tried again, still missing. Updated my software, still missing. I checked the help but couldn’t find a description of my problem. Not even google could help me out. This was getting annoying.

I went back to the dud PDF and discovered that if I tried to select the missing text in the affected cells, I could copy and paste it from the PDF to a text file, so it was actually there, just invisible.

So, probably a font issue? I modified the text properties to use a different font, different size, different colour. Nada. I edited the PDF settings in Acrobat Distiller to embed all fonts all the time, never substitute fonts, increase the resolution, decrease the resolution… You name it, I tried it, but the cell contents remained obstinately invisible.

Back in the source files, I tried recreating tables and changing font settings, but nothing worked.

Finally, I gave up my investigations, grabbed a cuppa and vented at a colleague. He described a similar problem he’d had when working in PowerPoint. In that instance,  a background had rendered in front of the content on saving to PDF, so to fix the problem he selected the background and sent it to back in the source file. Food for thought.

I decided to check out the table properties in FrameMaker, and there it was: row backgrounds were set to white. But the page was already white, so I could safely remove that. I set the background to None instead for the affected tables, saved as PDF one more time, and my invisible content reappeared. Huzzah!

Still no idea why the problem affected first content cells only, or only a random subset of the tables in the document, but if I ever encounter disappearing content in table cells again, I’ll be checking out my cell background properties first.

A completely different cause of and solution to text disappearing when FrameMaker files were saved as PDFs is covered here.