I am preparing a practical class of physics in which I need to justify the following text that is very extensive. But when I use StringSplit or MapAt to highlight certain important words, I do not get a justified text and I do not know what to do. The code is the following:

text = Style[#, Bold, FontFamily -> "Comic Sans MS", 24] & /@ 
    "En este tipo de difracción, las distancias fuente-objeto, ojeto-pantalla son grandes lo que implica que las ondas se pueden representar como  lineas paralelas en la dirección de propagación de sus frentes.La difracción de Fraunhoffer no permite obtener una condición de máximo y una de mínimo al estilo de las obtenidas para la interferencia, por ello se trabaja de forma especial con los casos de una rendija y múltiples rendijas, ya que no se pueden contar las ondas coherentes que se superponen porque la distribución continua de las fuentes luminosas y la superposición de las ondas en un punto     dado se refleja matemáticamente por una integral. (Óptica Ondulatoria, Héctor León,pág.373)"

    MapAt[Style[#, Bold, 24, Red] &, text, {{21 ;; 31}, {54}, {60 ;; 80}}], 
  TextJustification -> 1
  • Can you comment on my answer? – Kuba 2 days ago
  • Thank you for answering my question and thanks again because your code has allowed me to finish my class on time, your help has been of great value to me. – Andres yesterday
  • I am glad I could help :) – Kuba yesterday
up vote 1 down vote accepted

It seems Row in TextCell can't have a second argument if you want it to behave correctly. That usage is mentioned in details and options section. Let's add Riffle:

  Row @ 
  Riffle[#, " "]& @ 
    Style[#, Bold, 24, Red] &, 
    {{21 ;; 31}, {54}, {60 ;; 80}}
 TextJustification -> 1, 

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.