I recently received a project which automatically converts a .xml file to Latex and afterwards to pdf.

The pdf file contains multiple longtables and because there's no word-wrapping inside the tables yet, they're too wide. Automatically converted latex from html

Because I couldn't find a way to convert the word-wrapping in html to latex, I made a Powershell script, which replaces one of the 'l' with a 'p{5cm}'. The script itself worked perfectly fine, but then I started getting these "text contains invalid character" errors: Invalid character error in logfile

These errors only happen when I add the 'p{5cm}'. I also noticed that my .aux file is way shorter than before and my .toc file is completely empty. AuxFile after running selfmade script

So my questions are:

  • Is there another way to add word-wrapping inside columns when converting from html to Latex besides my approach?
  • How did it come to this error and how do I fix it?

I'm relatively new to Latex so feel free to give detailed information or links where I can learn about it.

Thanks in advance

  • 2
    My first guess would be that your script did not work perfectly and replaced more than you wanted. – Ulrike Fischer Sep 12 '18 at 10:49
  • you have a control character between every letter on that line, how did you edit the file? Tex is not adding these they are in the input file. – David Carlisle Sep 12 '18 at 12:40
  • has your file been saved as UTF-16 (so has a 0 byte every second byte)? – David Carlisle Sep 12 '18 at 12:42
  • That exactly was my problem. I managed to fix it by adding the encoding parameter in my script. Thank you very much @DavidCarlisle – Roychard Sep 12 '18 at 14:11

The log shows a control character every other character. The usual reason for that is the file being saved in UTF-16 which means (for Latin alphabet text) that every other byte is 0 (null). Try re-saving the file in UTF-8.

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.