Closed dbmrq closed 6 years ago
Thanks for this, and I'm glad that latexindent.pl
works for you :)
Starting with your starting text in a file called mwe.tex
, I was able to produce (pretty much) your final output, but I did need two passes:
latexindent.pl mwe -o=+-mod1.tex -m -y="modifyLineBreaks:oneSentencePerLine:manipulateSentences:1"
latexindent.pl mwe-mod1.tex -m -l=dbmrq -w
with
dbmrq.yaml
specialBeginEnd:
sentences:
begin: '[A-Z]'
end: '(?:\.|\?)'
lookForThis: 1
modifyLineBreaks:
textWrapOptions:
columns: 77
and this gives
mwe-mod1.tex
If you do enough work in any sort of free software environment, you get used
to doing lots of writing of documentation or all sorts of other things in
some plaintext system which exports to some non-plaintext system.
One way or another you have to decide: are you going to wrap your lines with
newlines?
And of course the answer should be "yes" because lines that trail all the
way off the edge of your terminal is a sin against the plaintext gods, who
are deceptively mighty, and whose wrath is to be feared (and blessings to be
embraced).
So okay, of course one line per paragraph is off the table.
So what do you do?
I think that the two-pass approach seems to make your question a duplicate of https://github.com/cmhughes/latexindent.pl/issues/103, which you linked to.... what do you think?
I'm happy to leave this open as a reminder of a test case against which I can test the development of https://github.com/cmhughes/latexindent.pl/issues/103
Oh, that's perfect!
It's up to you then whether to keep this open or not.
Thanks again, latexindent is awesome. :)
Many thanks, that's great :)
I've just released V3.4.2, and am hoping to tackle https://github.com/cmhughes/latexindent.pl/issues/103 as one of my next latexindent.pl priorities. Updates will follow, as and when.
I gave this a try with a real tex file and I can't get it to work. :(
Using this mwe.tex
file:
A distinção entre conteúdo \emph{real} e conteúdo \emph{intencional} está
relacionada, ainda, à distinção entre o conceito husserliano de
\emph{experiência} e o uso popular desse termo. No sentido comum,
o \term{experimentado} é um complexo de eventos exteriores,
e o \term{experimentar} consiste em percepções (além de julgamentos e outros
atos) nas quais tais eventos aparecem como objetos, e objetos frequentemente
relacionados ao ego empírico. Nesse sentido, diz-se, por exemplo, que se
\term{experimentou} uma guerra. No sentido fenomenológico, no entanto,
é evidente que os eventos ou objetos externos não estão dentro do ego que os
experimenta, nem são seu conteúdo ou suas partes constituintes
\cite[5.][3]{lu}. Experimentar eventos exteriores, nesse sentido, significa
direcionar certos atos de percepção a tais eventos, de modo que certos
conteúdos constituem, então, uma unidade de consciência no fluxo unificado de
um ego empírico. Nesse caso, temos um todo \emph{real} do qual se pode dizer
que cada parte é de fato \emph{experimentada}. Enquanto no primeiro sentido há
uma distinção entre o conteúdo da consciência e aquilo que é experimentado
(e.g.\, entre a sensação e aquilo que é sentido), nesse último sentido aquilo
que o ego ou a consciência experimenta \emph{é} seu conteúdo.
The steps you described result in this:
A distinção entre conteúdo \emph{real} e conteúdo \emph{intencional} está
relacionada, ainda, à distinção entre o conceito husserliano de
\emph{experiência} e o uso popular desse termo.
No sentido comum, o \term{experimentado} é um complexo de eventos
exteriores, e o \term{experimentar} consiste em percepções (além de
julgamentos e outros atos) nas quais tais eventos aparecem como objetos, e
objetos frequentemente relacionados ao ego empírico.
Nesse sentido, diz-se, por exemplo, que se \term{experimentou} uma guerra.
No sentido fenomenológico, no entanto, é evidente que os eventos ou objetos
externos não estão dentro do ego que os experimenta, nem são seu conteúdo ou
suas partes constituintes \cite[5.
][3]{lu}.
Experimentar eventos exteriores, nesse sentido, significa direcionar certos
atos de percepção a tais eventos, de modo que certos conteúdos constituem,
então, uma unidade de consciência no fluxo unificado de um ego empírico.
Nesse caso, temos um todo \emph{real} do qual se pode dizer que cada parte é
de fato \emph{experimentada}.
Enquanto no primeiro sentido há uma distinção entre o conteúdo da
consciência e aquilo que é experimentado (e.g.\, entre a sensação e aquilo
que é sentido), nesse último sentido aquilo que o ego ou a consciência
experimenta \emph{é} seu conteúdo.
While I was hoping for this:
A distinção entre conteúdo \emph{real} e conteúdo \emph{intencional}
está relacionada, ainda, à distinção entre o conceito husserliano de
\emph{experiência} e o uso popular desse termo.
No sentido comum, o \term{experimentado} é um complexo de eventos exteriores,
e o \term{experimentar} consiste em percepções (além de julgamentos e outros
atos) nas quais tais eventos aparecem como objetos, e objetos frequentemente
relacionados ao ego empírico.
Nesse sentido, diz-se, por exemplo, que se \term{experimentou} uma guerra.
No sentido fenomenológico, no entanto, é evidente que os eventos ou objetos
externos não estão dentro do ego que os experimenta, nem são seu conteúdo ou
suas partes constituintes \cite[5.][3]{lu}.
Experimentar eventos exteriores, nesse sentido, significa direcionar certos
atos de percepção a tais eventos, de modo que certos conteúdos constituem,
então, uma unidade de consciência no fluxo unificado de um ego empírico.
Nesse caso, temos um todo \emph{real} do qual se pode dizer que cada parte é
de fato \emph{experimentada}.
Enquanto no primeiro sentido há uma distinção entre o conteúdo da consciência
e aquilo que é experimentado (e.g.\, entre a sensação e aquilo que é
sentido), nesse último sentido aquilo que o ego ou a consciência experimenta
\emph{é} seu conteúdo.
Any ideas?
Apologies for the delay, I've been focused on https://github.com/cmhughes/latexindent.pl/issues/103.
I can confirm that the YAML I've provided fails in the code that you've provided.
This request is an upgrade to the oneSentencePerLine
to have the option to perform text wrapping on each sentence, and furthermore for these sentences to have their bodies to be indented.
Let me look into this a little bit; it's not clear if this will be possible or not. I'm neither committing to nor dismissing the idea :)
No problem, thank you! :)
@dbmrq as of https://github.com/cmhughes/latexindent.pl/commit/2901ac70728117456cd562a9ffe7e2e86ee1d413 I'd say that this is implemented.
As an example, starting with your code as given above, and using the following YAML
dbmrq1.yaml
modifyLineBreaks:
oneSentencePerLine:
manipulateSentences: 1
removeSentenceLineBreaks: 1
textWrapSentences: 1
sentenceIndent: " "
sentencesEndWith:
betterFullStop: 0
other: '(?:\.\)(?!\h*[a-z]))|(?:(?<!(?:(?:e\.g)|(?:i\.e)|(?:etc))))\.(?!(?:[a-z]|[A-Z]|\]|\-|\,|[0-9]))'
textWrapOptions:
columns: 50
then you receive the following output
A distinção entre conteúdo \emph{real} e conteúdo
\emph{intencional} está relacionada, ainda, à
distinção entre o conceito husserliano de
\emph{experiência} e o uso popular desse termo.
No sentido comum, o \term{experimentado} é um
complexo de eventos exteriores, e o
\term{experimentar} consiste em percepções (além
de julgamentos e outros atos) nas quais tais
eventos aparecem como objetos, e objetos
frequentemente relacionados ao ego empírico.
Nesse sentido, diz-se, por exemplo, que se
\term{experimentou} uma guerra.
No sentido fenomenológico, no entanto, é evidente
que os eventos ou objetos externos não estão
dentro do ego que os experimenta, nem são seu
conteúdo ou suas partes constituintes
\cite[5.][3]{lu}.
Experimentar eventos exteriores, nesse sentido,
significa direcionar certos atos de percepção a
tais eventos, de modo que certos conteúdos
constituem, então, uma unidade de consciência no
fluxo unificado de um ego empírico.
Nesse caso, temos um todo \emph{real} do qual se
pode dizer que cada parte é de fato
\emph{experimentada}.
Enquanto no primeiro sentido há uma distinção
entre o conteúdo da consciência e aquilo que é
experimentado (e.g.\, entre a sensação e aquilo
que é sentido), nesse último sentido aquilo que o
ego ou a consciência experimenta \emph{é} seu
conteúdo.
Can you pull the develop
branch and see if it behaves as you would like?
@cmhughes I added the yaml config to localSettings.yaml
and used the -l
flag. The log says:
INFO: YAML settings, reading from the following files:
Reading USER settings from ./localSettings.yaml
---
modifyLineBreaks:
oneSentencePerLine:
manipulateSentences: '1'
removeSentenceLineBreaks: '1'
sentenceIndent: ' '
sentencesEndWith:
betterFullStop: '0'
other: (?:\.\)(?!\h*[a-z]))|(?:(?<!(?:(?:e\.g)|(?:i\.e)|(?:etc))))\.(?!(?:[a-z]|[A-Z]|\]|\-|\,|[0-9]))
textWrapSentences: '1'
textWrapOptions:
columns: '50'
However, the output text is exactly the same as the input; no indentation is done. I don't know if I'm doing something wrong there. 🤷♂️
Your example is exactly what I had in mind, though. Thanks! :)
Can I check the following:
You've got the latest develop? You're calling the script with the -m switch, eg latexindent -m -l myfile
On 12 Aug 2018 22:38, "Daniel Marques" notifications@github.com wrote:
@cmhughes https://github.com/cmhughes I added the yaml config to localSettings.yaml and used the -l flag. The log says:
modifyLineBreaks:
oneSentencePerLine:
manipulateSentences: '1'
removeSentenceLineBreaks: '1'
sentenceIndent: ' '
sentencesEndWith:
betterFullStop: '0'
other:
(?:.)(?!\h*[a-z]))|(?:(?<!(?:(?:e.g)|(?:i.e)|(?:etc)))).(?!(?:[a-z]|[A-Z]|]|-|\,|[0-9])) textWrapSentences: '1' textWrapOptions: columns: '50'
However, the output text is exactly the same as the input; no indentation is done. I don't know if I'm doing something wrong there. 🤷♂️
Your example is exactly what I had in mind, though. Thanks! :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/111#issuecomment-412373506, or mute the thread https://github.com/notifications/unsubscribe-auth/ACHxYO_QvyVWPqJGwK2F-9ZbA2MxunbBks5uQKBDgaJpZM4TprTw .
Ah! I forgot the -m
flag! 🤦🏻♂️
I just tried it again and it's working perfectly. Thank you!
Excellent, many thanks for confirming :) I hope to get V3.5 released within the next week or so.
On Mon, 13 Aug 2018, 08:35 Daniel Marques, notifications@github.com wrote:
Ah! I forgot the -m flag! 🤦🏻♂️
I just tried it again and it's working perfectly. Thank you!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/111#issuecomment-412432952, or mute the thread https://github.com/notifications/unsubscribe-auth/ACHxYLec37Q6X2bictgq7WCY9OWvOvo-ks5uQSxfgaJpZM4TprTw .
Resolved as of https://github.com/cmhughes/latexindent.pl/pull/127 upload to ctan imminently.
Hello,
First of all, thank you for you great job with latexindent! 🎉
The option to use one sentence per line is already great, but it would be even better if there were a way to do it in this style: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/
So this text:
Would be formatted like this:
This and #103 together would make latexindent absolutely perfect for me.