I'm working with Rmarkdown and my output is a pdf document. When reading the text, I noticed that so many words are printed incomplete such as "ar- rojan" and "progra- mación" (which should be "arrojan" and "programación"):

   Los operadores <, >, <=, >=, == y != se denominan “lógicos” o “booleanos” porque nos ar­-
   rojan como resultado TRUE si se cumple la condición o comparación o FALSE en caso contrario.

   Sin embargo, R, al igual que la mayoría de los lenguajes de progra­-
   mación distingue entre mayúsculas y minúsculas (“case sensitive”),

Based on my little experience with Rmarkdown, I guess in the YAML section I must include some option to prevent for incomplete words but I can't find any documentation related with my needs. This is my YAML:

title: "--"
author: ""
date: "--"
    latex_engine: xelatex
mainfont: Times New Roman
- \usepackage{titling}
- \pretitle{\begin{flushleft}\huge\bfseries}
- \posttitle{\end{flushleft}}
- \preauthor{\begin{flushleft}\Large}
- \postauthor{\end{flushleft}}
- \predate{\begin{flushleft}\large}
- \postdate{\end{flushleft}}
fontsize: 12pt
urlcolor: blue
linestretch: 1.15

Thanks in advance for any suggestion or comment.

  • your question isn't very clear (and appears to be more about R than about TeX so isn't clearly on topic here) but the text in your first code block appears to be your input file and it already has the words hyphenated, can't you just fix that input? TeX can not un-hyphenate that input. – David Carlisle Mar 4 at 19:16
  • in my input file words are complete but they are printed incomplete in the pdf output. That's why I'm asking if there's any option to prevent this kind of behaviour. – Alejandro Carrera Mar 4 at 19:18
  • in that case I do not understand your question at all. What is the text in the first code block if it is not your input? Is it cut and paste from the pdf? you want to add \raggedright to your document preamble (However that is done in R markdown) so that tex does not try to justify the right margin. possibly just needs - \raggedright in that header includes yml block – David Carlisle Mar 4 at 19:20
  • Yes, I copy-pasted the text as it appears in my pdf document. \raggedright doesn't solve my problem because I want my text justified just like when you use "Justify" command in Microsoft Word. I asked in StackOverflow because as you said, maybe this is a question more about R that TeX. Thank you. – Alejandro Carrera Mar 4 at 20:04
  • this is normal latex behaviour. The words are not incomplete, there are simply hyphenated to allow the space between words to not stretch too much. One thing you can try which will reduce instances of hyphenation is to use the microtype package. This slightly changes the characters to help fit every thing without hyphenating as much as possible. If you want to complete prevent hyphenation (athough not advisable as output will be rather ugly, have a look at this question tex.stackexchange.com/questions/5036/… – ArTourter Mar 4 at 20:12

Browse other questions tagged or ask your own question.