Python – Unable to make each sentence to start at a new line in LaTex by AWK/Python

awklatexpython

I have a long document in LaTex, which contains paragraphs. The paragraphs contain sentences such that no subsequent sentence start at a new line.

How can you make each subsequent sentence to start at a new line in my .tex file?

My attempt to the problem

We need to put \n to the end of Sentence B where Sentence B has Sentence A before it.

We must not put \n to the situations where there are the mark \.

I see that the problem can be solved by AWK and Python.

Best Answer

What's wrong with putting a newline after each period? Eg:

awk '{ gsub(/\. +/, ".\n"); print }'

$ echo "abc. 123. xyz." | awk '{ gsub(/\. +/, ".\n"); print }'
abc.
123.
xyz.
Related Topic