Auto Detect Last Paragraph and Pass to Macro
up vote
3
down vote
favorite
The MWE below produces the desired results:
via the ProcessLastPara{}
which applies a desired parshape
to the given (last) paragraph.
Questions:
The MWE below required me to manually identify both the start and end of the last paragraph so it could be passed on to the ProcessLastPara{}
macro.
Is it possible to achieve the effect of
ProcessLastPara{<text>}
by simply identifying the beginning of the last paragraph. That is, can I change the call toSetMyText
to be of the form:
SetMyText{%
Other Text...
LastParaBeginsHere
Last Para Text%
}%
so that
LastParaBeginsHere
invokesProcessLastPara{Last Para Text}
.
This would need some error checking to make sure that
LastParaBeginsHere
really was indeed the last paragraph defined bySetMyText
.
Is it possible to auto detect where the last paragraph begins and ends so that I do not need to manually invoke
ProcessLastPara{}
and identify the text of the last paragraph?
Notes:
- This needs to work for the case where the text is defined in a macro before it is typeset.
- The solution of
defLastParaBeginsHere{LastParShape}
won't work as I need to process the last paragraph text to determine the appropriateparshape
to apply. That is, this is a 2 step process, the details of which are not included here to simplify the test case.
Code:
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
newcommand*{ProcessLastPara}[1]{%
LastParShape
#1}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
ProcessLastPara{%
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}%
}%
%% ----------------
OutputMyText%
end{document}
macros line-breaking paragraphs
add a comment |
up vote
3
down vote
favorite
The MWE below produces the desired results:
via the ProcessLastPara{}
which applies a desired parshape
to the given (last) paragraph.
Questions:
The MWE below required me to manually identify both the start and end of the last paragraph so it could be passed on to the ProcessLastPara{}
macro.
Is it possible to achieve the effect of
ProcessLastPara{<text>}
by simply identifying the beginning of the last paragraph. That is, can I change the call toSetMyText
to be of the form:
SetMyText{%
Other Text...
LastParaBeginsHere
Last Para Text%
}%
so that
LastParaBeginsHere
invokesProcessLastPara{Last Para Text}
.
This would need some error checking to make sure that
LastParaBeginsHere
really was indeed the last paragraph defined bySetMyText
.
Is it possible to auto detect where the last paragraph begins and ends so that I do not need to manually invoke
ProcessLastPara{}
and identify the text of the last paragraph?
Notes:
- This needs to work for the case where the text is defined in a macro before it is typeset.
- The solution of
defLastParaBeginsHere{LastParShape}
won't work as I need to process the last paragraph text to determine the appropriateparshape
to apply. That is, this is a 2 step process, the details of which are not included here to simplify the test case.
Code:
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
newcommand*{ProcessLastPara}[1]{%
LastParShape
#1}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
ProcessLastPara{%
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}%
}%
%% ----------------
OutputMyText%
end{document}
macros line-breaking paragraphs
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
The MWE below produces the desired results:
via the ProcessLastPara{}
which applies a desired parshape
to the given (last) paragraph.
Questions:
The MWE below required me to manually identify both the start and end of the last paragraph so it could be passed on to the ProcessLastPara{}
macro.
Is it possible to achieve the effect of
ProcessLastPara{<text>}
by simply identifying the beginning of the last paragraph. That is, can I change the call toSetMyText
to be of the form:
SetMyText{%
Other Text...
LastParaBeginsHere
Last Para Text%
}%
so that
LastParaBeginsHere
invokesProcessLastPara{Last Para Text}
.
This would need some error checking to make sure that
LastParaBeginsHere
really was indeed the last paragraph defined bySetMyText
.
Is it possible to auto detect where the last paragraph begins and ends so that I do not need to manually invoke
ProcessLastPara{}
and identify the text of the last paragraph?
Notes:
- This needs to work for the case where the text is defined in a macro before it is typeset.
- The solution of
defLastParaBeginsHere{LastParShape}
won't work as I need to process the last paragraph text to determine the appropriateparshape
to apply. That is, this is a 2 step process, the details of which are not included here to simplify the test case.
Code:
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
newcommand*{ProcessLastPara}[1]{%
LastParShape
#1}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
ProcessLastPara{%
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}%
}%
%% ----------------
OutputMyText%
end{document}
macros line-breaking paragraphs
The MWE below produces the desired results:
via the ProcessLastPara{}
which applies a desired parshape
to the given (last) paragraph.
Questions:
The MWE below required me to manually identify both the start and end of the last paragraph so it could be passed on to the ProcessLastPara{}
macro.
Is it possible to achieve the effect of
ProcessLastPara{<text>}
by simply identifying the beginning of the last paragraph. That is, can I change the call toSetMyText
to be of the form:
SetMyText{%
Other Text...
LastParaBeginsHere
Last Para Text%
}%
so that
LastParaBeginsHere
invokesProcessLastPara{Last Para Text}
.
This would need some error checking to make sure that
LastParaBeginsHere
really was indeed the last paragraph defined bySetMyText
.
Is it possible to auto detect where the last paragraph begins and ends so that I do not need to manually invoke
ProcessLastPara{}
and identify the text of the last paragraph?
Notes:
- This needs to work for the case where the text is defined in a macro before it is typeset.
- The solution of
defLastParaBeginsHere{LastParShape}
won't work as I need to process the last paragraph text to determine the appropriateparshape
to apply. That is, this is a 2 step process, the details of which are not included here to simplify the test case.
Code:
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
newcommand*{ProcessLastPara}[1]{%
LastParShape
#1}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
ProcessLastPara{%
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}%
}%
%% ----------------
OutputMyText%
end{document}
macros line-breaking paragraphs
macros line-breaking paragraphs
asked 3 hours ago
Peter Grill
163k24432744
163k24432744
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago
add a comment |
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1LastParShapepar}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
dimexpr0.10hsize-parindentrelax 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.%
}%
%% ----------------
OutputMyText%
end{document}
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
add a comment |
up vote
1
down vote
It's quite easy with expl3
: collect the text, split it at par
, then detach the last paragraph and typeset it separately.
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{SetMyText}{s+m}
{
IfBooleanTF{#1}
{
seq_set_split:NnV l_peter_mytext_seq { par } #2
}
{
seq_set_split:Nnn l_peter_mytext_seq { par } { #2 }
}
}
cs_generate_variant:Nn seq_set_split:Nnn { NnV }
seq_new:N l_peter_mytext_seq
tl_new:N l_peter_mytext_tl
NewDocumentCommand{OutputMyText}{}
{
seq_pop_right:NN l_peter_mytext_seq l_peter_mytext_tl
seq_use:Nn l_peter_mytext_seq { par } par
LastParShape l_peter_mytext_tl
}
ExplSyntaxOff
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}
begin{document}
SetMyText{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
}
OutputMyText
end{document}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1LastParShapepar}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
dimexpr0.10hsize-parindentrelax 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.%
}%
%% ----------------
OutputMyText%
end{document}
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
add a comment |
up vote
2
down vote
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1LastParShapepar}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
dimexpr0.10hsize-parindentrelax 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.%
}%
%% ----------------
OutputMyText%
end{document}
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
add a comment |
up vote
2
down vote
up vote
2
down vote
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1LastParShapepar}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
dimexpr0.10hsize-parindentrelax 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.%
}%
%% ----------------
OutputMyText%
end{document}
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
makeatletter
newcommand{@MyText}{}
newcommand{SetMyText}[1]{def@MyText{#1LastParShapepar}}%
newcommand*{OutputMyText}{@MyText}%
makeatother
newcommand*{LastParShape}{%
parshape 5
dimexpr0.10hsize-parindentrelax 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}%
begin{document}
SetMyText{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.%
}%
%% ----------------
OutputMyText%
end{document}
answered 2 hours ago
David Carlisle
480k3811121848
480k3811121848
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
add a comment |
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
1
1
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
I didn't even need egreg's hat.
– David Carlisle
2 hours ago
add a comment |
up vote
1
down vote
It's quite easy with expl3
: collect the text, split it at par
, then detach the last paragraph and typeset it separately.
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{SetMyText}{s+m}
{
IfBooleanTF{#1}
{
seq_set_split:NnV l_peter_mytext_seq { par } #2
}
{
seq_set_split:Nnn l_peter_mytext_seq { par } { #2 }
}
}
cs_generate_variant:Nn seq_set_split:Nnn { NnV }
seq_new:N l_peter_mytext_seq
tl_new:N l_peter_mytext_tl
NewDocumentCommand{OutputMyText}{}
{
seq_pop_right:NN l_peter_mytext_seq l_peter_mytext_tl
seq_use:Nn l_peter_mytext_seq { par } par
LastParShape l_peter_mytext_tl
}
ExplSyntaxOff
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}
begin{document}
SetMyText{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
}
OutputMyText
end{document}
add a comment |
up vote
1
down vote
It's quite easy with expl3
: collect the text, split it at par
, then detach the last paragraph and typeset it separately.
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{SetMyText}{s+m}
{
IfBooleanTF{#1}
{
seq_set_split:NnV l_peter_mytext_seq { par } #2
}
{
seq_set_split:Nnn l_peter_mytext_seq { par } { #2 }
}
}
cs_generate_variant:Nn seq_set_split:Nnn { NnV }
seq_new:N l_peter_mytext_seq
tl_new:N l_peter_mytext_tl
NewDocumentCommand{OutputMyText}{}
{
seq_pop_right:NN l_peter_mytext_seq l_peter_mytext_tl
seq_use:Nn l_peter_mytext_seq { par } par
LastParShape l_peter_mytext_tl
}
ExplSyntaxOff
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}
begin{document}
SetMyText{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
}
OutputMyText
end{document}
add a comment |
up vote
1
down vote
up vote
1
down vote
It's quite easy with expl3
: collect the text, split it at par
, then detach the last paragraph and typeset it separately.
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{SetMyText}{s+m}
{
IfBooleanTF{#1}
{
seq_set_split:NnV l_peter_mytext_seq { par } #2
}
{
seq_set_split:Nnn l_peter_mytext_seq { par } { #2 }
}
}
cs_generate_variant:Nn seq_set_split:Nnn { NnV }
seq_new:N l_peter_mytext_seq
tl_new:N l_peter_mytext_tl
NewDocumentCommand{OutputMyText}{}
{
seq_pop_right:NN l_peter_mytext_seq l_peter_mytext_tl
seq_use:Nn l_peter_mytext_seq { par } par
LastParShape l_peter_mytext_tl
}
ExplSyntaxOff
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}
begin{document}
SetMyText{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
}
OutputMyText
end{document}
It's quite easy with expl3
: collect the text, split it at par
, then detach the last paragraph and typeset it separately.
documentclass{article}
usepackage[paperwidth=15cm]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentCommand{SetMyText}{s+m}
{
IfBooleanTF{#1}
{
seq_set_split:NnV l_peter_mytext_seq { par } #2
}
{
seq_set_split:Nnn l_peter_mytext_seq { par } { #2 }
}
}
cs_generate_variant:Nn seq_set_split:Nnn { NnV }
seq_new:N l_peter_mytext_seq
tl_new:N l_peter_mytext_tl
NewDocumentCommand{OutputMyText}{}
{
seq_pop_right:NN l_peter_mytext_seq l_peter_mytext_tl
seq_use:Nn l_peter_mytext_seq { par } par
LastParShape l_peter_mytext_tl
}
ExplSyntaxOff
newcommand*{LastParShape}{%
parshape 5
0.10hsize 0.80hsize
0.15hsize 0.70hsize
0.20hsize 0.60hsize
0.25hsize 0.50hsize
0.30hsize 0.40hsize
}
begin{document}
SetMyText{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
}
OutputMyText
end{document}
answered 2 hours ago
egreg
704k8618753154
704k8618753154
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464468%2fauto-detect-last-paragraph-and-pass-to-macro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you want the para indent on the first line of your triangle, I cancelled it out (not quite correctly) in my answer but I could remove it to get the same shape that you and egreg show...
– David Carlisle
2 hours ago