lettrines, explicit linebreaks and hanging indents
up vote
4
down vote
favorite
I need to combine lettrines, explicit linebreaks and hanging indents for whatever chunk of text ends up being longer than one typeset line.
For the sake of semiautomatic text-production I'd very much prefer just to have to deal with one (custom) linebreaking command (lb
in the example).
When using newline
the lettrines are displayed correctly (not overwritten by the following line), but everything apart from the first line of the whole text will be set hanging.
With par
the hanging indent is correct but not for the lines affected by the lettrine:
documentclass[11pt,a5paper]{article}
usepackage[showframe]{geometry}
usepackage{lettrine}
%newcommand{lb}{newline}
newcommand{lb}{par}
setlength{leftskip}{5cm}
setlength{parindent}{-5cm}
begin{document}
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
lettrine{A}{} short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
I am searching for a way to have lettrines and normal text all to align to the left and long lines to be indented negatively as shown here:
line-breaking indentation lettrine
This question has an open bounty worth +150
reputation from Florian ending in 2 days.
This question has not received enough attention.
add a comment |
up vote
4
down vote
favorite
I need to combine lettrines, explicit linebreaks and hanging indents for whatever chunk of text ends up being longer than one typeset line.
For the sake of semiautomatic text-production I'd very much prefer just to have to deal with one (custom) linebreaking command (lb
in the example).
When using newline
the lettrines are displayed correctly (not overwritten by the following line), but everything apart from the first line of the whole text will be set hanging.
With par
the hanging indent is correct but not for the lines affected by the lettrine:
documentclass[11pt,a5paper]{article}
usepackage[showframe]{geometry}
usepackage{lettrine}
%newcommand{lb}{newline}
newcommand{lb}{par}
setlength{leftskip}{5cm}
setlength{parindent}{-5cm}
begin{document}
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
lettrine{A}{} short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
I am searching for a way to have lettrines and normal text all to align to the left and long lines to be indented negatively as shown here:
line-breaking indentation lettrine
This question has an open bounty worth +150
reputation from Florian ending in 2 days.
This question has not received enough attention.
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I need to combine lettrines, explicit linebreaks and hanging indents for whatever chunk of text ends up being longer than one typeset line.
For the sake of semiautomatic text-production I'd very much prefer just to have to deal with one (custom) linebreaking command (lb
in the example).
When using newline
the lettrines are displayed correctly (not overwritten by the following line), but everything apart from the first line of the whole text will be set hanging.
With par
the hanging indent is correct but not for the lines affected by the lettrine:
documentclass[11pt,a5paper]{article}
usepackage[showframe]{geometry}
usepackage{lettrine}
%newcommand{lb}{newline}
newcommand{lb}{par}
setlength{leftskip}{5cm}
setlength{parindent}{-5cm}
begin{document}
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
lettrine{A}{} short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
I am searching for a way to have lettrines and normal text all to align to the left and long lines to be indented negatively as shown here:
line-breaking indentation lettrine
I need to combine lettrines, explicit linebreaks and hanging indents for whatever chunk of text ends up being longer than one typeset line.
For the sake of semiautomatic text-production I'd very much prefer just to have to deal with one (custom) linebreaking command (lb
in the example).
When using newline
the lettrines are displayed correctly (not overwritten by the following line), but everything apart from the first line of the whole text will be set hanging.
With par
the hanging indent is correct but not for the lines affected by the lettrine:
documentclass[11pt,a5paper]{article}
usepackage[showframe]{geometry}
usepackage{lettrine}
%newcommand{lb}{newline}
newcommand{lb}{par}
setlength{leftskip}{5cm}
setlength{parindent}{-5cm}
begin{document}
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
lettrine{A}{} short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
I am searching for a way to have lettrines and normal text all to align to the left and long lines to be indented negatively as shown here:
line-breaking indentation lettrine
line-breaking indentation lettrine
edited Dec 6 at 13:08
asked Dec 3 at 19:34
Florian
1,3011327
1,3011327
This question has an open bounty worth +150
reputation from Florian ending in 2 days.
This question has not received enough attention.
This question has an open bounty worth +150
reputation from Florian ending in 2 days.
This question has not received enough attention.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
Not sure of what are you trying to do exactly, but for lines without drop capitals is enough everypar{hangindent5cm}
and of course each line must be a paragraph.
In case that you do not want the hang indent after some lines, add also handafter
.
Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via lettrine
options you can simulate a hangindent
and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.
It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use newline
.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.
For simplicity the MWE bellow show par
instead of blank lines and macros only for the dummy text:
documentclass[11pt,a5paper]{article}
usepackage{geometry}
usepackage{lettrine,lipsum,xcolor}
setlength{parindent}{0pt}
% dummy text definitions
defkantreason{our knowledge begins with the senses,
proceeds then to the understanding, and ends with reason.
There is nothing higher than reason.}
defshortext{A pretty short line of regular text.}
defdroptext{Another short line with lettrine.}
begin{document}
{parsetlength{parskip}{1ex}
everypar{hangindent5cm}
shortext
lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll}
kantreason
newline droptext newline droptext
parshortext
par All kantreason
parshortext
par All kantreason
lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0,
findent=-5pt,nindent=2cm]{A}{ll} kantreason
parshortext
parhangafter3shortextshortextshortextshortext
shortextshortextshortextshortextshortext
par} % group must end with par!!!
end{document}
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace thepar
s withnewline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.
– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
add a comment |
up vote
2
down vote
Instead of using lettrine
, you can adjust the parshape
to wrap around the letter. This way a newline
would work without problem.
documentclass{article}
usepackage{lettrine,graphicx}
newcommand{lb}{newline}
% https://tex.stackexchange.com/q/127504/5764
makeatletter
defnewparshape{parshape@npshape0{}}
def@npshape#1#2#3{ifx\#3expandafter@@@npshapeelseexpandafter@@npshapefi
{#1}{#2}{#3}}
def@@npshape#1#2#3#4#5{%
ifnum#3>z@expandafter@firstoftwoelseexpandafter@secondoftwofi
{expandafter@@npshapeexpandafter{thenumexpr#1+1relax}{#2 #4 #5}{numexpr#3-1relax}{#4}{#5}}%
{@npshape{#1}{#2}}}
def@@@npshape#1#2#3{#1 #2 }
makeatother
begin{document}
raggedright
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
In a bigger document, you could define a "lettrine
" for each letter, say:
newcommand{LettrineA}{%
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}%
}
newcommand{LettrineB}{%
% ...
}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Not sure of what are you trying to do exactly, but for lines without drop capitals is enough everypar{hangindent5cm}
and of course each line must be a paragraph.
In case that you do not want the hang indent after some lines, add also handafter
.
Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via lettrine
options you can simulate a hangindent
and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.
It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use newline
.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.
For simplicity the MWE bellow show par
instead of blank lines and macros only for the dummy text:
documentclass[11pt,a5paper]{article}
usepackage{geometry}
usepackage{lettrine,lipsum,xcolor}
setlength{parindent}{0pt}
% dummy text definitions
defkantreason{our knowledge begins with the senses,
proceeds then to the understanding, and ends with reason.
There is nothing higher than reason.}
defshortext{A pretty short line of regular text.}
defdroptext{Another short line with lettrine.}
begin{document}
{parsetlength{parskip}{1ex}
everypar{hangindent5cm}
shortext
lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll}
kantreason
newline droptext newline droptext
parshortext
par All kantreason
parshortext
par All kantreason
lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0,
findent=-5pt,nindent=2cm]{A}{ll} kantreason
parshortext
parhangafter3shortextshortextshortextshortext
shortextshortextshortextshortextshortext
par} % group must end with par!!!
end{document}
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace thepar
s withnewline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.
– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
add a comment |
up vote
4
down vote
Not sure of what are you trying to do exactly, but for lines without drop capitals is enough everypar{hangindent5cm}
and of course each line must be a paragraph.
In case that you do not want the hang indent after some lines, add also handafter
.
Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via lettrine
options you can simulate a hangindent
and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.
It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use newline
.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.
For simplicity the MWE bellow show par
instead of blank lines and macros only for the dummy text:
documentclass[11pt,a5paper]{article}
usepackage{geometry}
usepackage{lettrine,lipsum,xcolor}
setlength{parindent}{0pt}
% dummy text definitions
defkantreason{our knowledge begins with the senses,
proceeds then to the understanding, and ends with reason.
There is nothing higher than reason.}
defshortext{A pretty short line of regular text.}
defdroptext{Another short line with lettrine.}
begin{document}
{parsetlength{parskip}{1ex}
everypar{hangindent5cm}
shortext
lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll}
kantreason
newline droptext newline droptext
parshortext
par All kantreason
parshortext
par All kantreason
lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0,
findent=-5pt,nindent=2cm]{A}{ll} kantreason
parshortext
parhangafter3shortextshortextshortextshortext
shortextshortextshortextshortextshortext
par} % group must end with par!!!
end{document}
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace thepar
s withnewline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.
– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
add a comment |
up vote
4
down vote
up vote
4
down vote
Not sure of what are you trying to do exactly, but for lines without drop capitals is enough everypar{hangindent5cm}
and of course each line must be a paragraph.
In case that you do not want the hang indent after some lines, add also handafter
.
Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via lettrine
options you can simulate a hangindent
and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.
It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use newline
.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.
For simplicity the MWE bellow show par
instead of blank lines and macros only for the dummy text:
documentclass[11pt,a5paper]{article}
usepackage{geometry}
usepackage{lettrine,lipsum,xcolor}
setlength{parindent}{0pt}
% dummy text definitions
defkantreason{our knowledge begins with the senses,
proceeds then to the understanding, and ends with reason.
There is nothing higher than reason.}
defshortext{A pretty short line of regular text.}
defdroptext{Another short line with lettrine.}
begin{document}
{parsetlength{parskip}{1ex}
everypar{hangindent5cm}
shortext
lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll}
kantreason
newline droptext newline droptext
parshortext
par All kantreason
parshortext
par All kantreason
lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0,
findent=-5pt,nindent=2cm]{A}{ll} kantreason
parshortext
parhangafter3shortextshortextshortextshortext
shortextshortextshortextshortextshortext
par} % group must end with par!!!
end{document}
Not sure of what are you trying to do exactly, but for lines without drop capitals is enough everypar{hangindent5cm}
and of course each line must be a paragraph.
In case that you do not want the hang indent after some lines, add also handafter
.
Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via lettrine
options you can simulate a hangindent
and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.
It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use newline
.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.
For simplicity the MWE bellow show par
instead of blank lines and macros only for the dummy text:
documentclass[11pt,a5paper]{article}
usepackage{geometry}
usepackage{lettrine,lipsum,xcolor}
setlength{parindent}{0pt}
% dummy text definitions
defkantreason{our knowledge begins with the senses,
proceeds then to the understanding, and ends with reason.
There is nothing higher than reason.}
defshortext{A pretty short line of regular text.}
defdroptext{Another short line with lettrine.}
begin{document}
{parsetlength{parskip}{1ex}
everypar{hangindent5cm}
shortext
lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll}
kantreason
newline droptext newline droptext
parshortext
par All kantreason
parshortext
par All kantreason
lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0,
findent=-5pt,nindent=2cm]{A}{ll} kantreason
parshortext
parhangafter3shortextshortextshortextshortext
shortextshortextshortextshortextshortext
par} % group must end with par!!!
end{document}
edited Dec 6 at 2:53
answered Dec 6 at 2:40
Fran
50.4k6111174
50.4k6111174
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace thepar
s withnewline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.
– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
add a comment |
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace thepar
s withnewline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.
– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace the
par
s with newline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.– Florian
Dec 6 at 12:48
Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace the
par
s with newline
s to make them display correctly but I'd much rather just use one kind of linebreak-command (lb
in my example) mainly because I will be generating the main text semiautomatically.– Florian
Dec 6 at 12:48
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
I've edited the question to hopefully make things clearer.
– Florian
Dec 6 at 13:09
2
2
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
@Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself.
– Fran
Dec 6 at 15:58
add a comment |
up vote
2
down vote
Instead of using lettrine
, you can adjust the parshape
to wrap around the letter. This way a newline
would work without problem.
documentclass{article}
usepackage{lettrine,graphicx}
newcommand{lb}{newline}
% https://tex.stackexchange.com/q/127504/5764
makeatletter
defnewparshape{parshape@npshape0{}}
def@npshape#1#2#3{ifx\#3expandafter@@@npshapeelseexpandafter@@npshapefi
{#1}{#2}{#3}}
def@@npshape#1#2#3#4#5{%
ifnum#3>z@expandafter@firstoftwoelseexpandafter@secondoftwofi
{expandafter@@npshapeexpandafter{thenumexpr#1+1relax}{#2 #4 #5}{numexpr#3-1relax}{#4}{#5}}%
{@npshape{#1}{#2}}}
def@@@npshape#1#2#3{#1 #2 }
makeatother
begin{document}
raggedright
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
In a bigger document, you could define a "lettrine
" for each letter, say:
newcommand{LettrineA}{%
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}%
}
newcommand{LettrineB}{%
% ...
}
add a comment |
up vote
2
down vote
Instead of using lettrine
, you can adjust the parshape
to wrap around the letter. This way a newline
would work without problem.
documentclass{article}
usepackage{lettrine,graphicx}
newcommand{lb}{newline}
% https://tex.stackexchange.com/q/127504/5764
makeatletter
defnewparshape{parshape@npshape0{}}
def@npshape#1#2#3{ifx\#3expandafter@@@npshapeelseexpandafter@@npshapefi
{#1}{#2}{#3}}
def@@npshape#1#2#3#4#5{%
ifnum#3>z@expandafter@firstoftwoelseexpandafter@secondoftwofi
{expandafter@@npshapeexpandafter{thenumexpr#1+1relax}{#2 #4 #5}{numexpr#3-1relax}{#4}{#5}}%
{@npshape{#1}{#2}}}
def@@@npshape#1#2#3{#1 #2 }
makeatother
begin{document}
raggedright
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
In a bigger document, you could define a "lettrine
" for each letter, say:
newcommand{LettrineA}{%
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}%
}
newcommand{LettrineB}{%
% ...
}
add a comment |
up vote
2
down vote
up vote
2
down vote
Instead of using lettrine
, you can adjust the parshape
to wrap around the letter. This way a newline
would work without problem.
documentclass{article}
usepackage{lettrine,graphicx}
newcommand{lb}{newline}
% https://tex.stackexchange.com/q/127504/5764
makeatletter
defnewparshape{parshape@npshape0{}}
def@npshape#1#2#3{ifx\#3expandafter@@@npshapeelseexpandafter@@npshapefi
{#1}{#2}{#3}}
def@@npshape#1#2#3#4#5{%
ifnum#3>z@expandafter@firstoftwoelseexpandafter@secondoftwofi
{expandafter@@npshapeexpandafter{thenumexpr#1+1relax}{#2 #4 #5}{numexpr#3-1relax}{#4}{#5}}%
{@npshape{#1}{#2}}}
def@@@npshape#1#2#3{#1 #2 }
makeatother
begin{document}
raggedright
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
In a bigger document, you could define a "lettrine
" for each letter, say:
newcommand{LettrineA}{%
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}%
}
newcommand{LettrineB}{%
% ...
}
Instead of using lettrine
, you can adjust the parshape
to wrap around the letter. This way a newline
would work without problem.
documentclass{article}
usepackage{lettrine,graphicx}
newcommand{lb}{newline}
% https://tex.stackexchange.com/q/127504/5764
makeatletter
defnewparshape{parshape@npshape0{}}
def@npshape#1#2#3{ifx\#3expandafter@@@npshapeelseexpandafter@@npshapefi
{#1}{#2}{#3}}
def@@npshape#1#2#3#4#5{%
ifnum#3>z@expandafter@firstoftwoelseexpandafter@secondoftwofi
{expandafter@@npshapeexpandafter{thenumexpr#1+1relax}{#2 #4 #5}{numexpr#3-1relax}{#4}{#5}}%
{@npshape{#1}{#2}}}
def@@@npshape#1#2#3{#1 #2 }
makeatother
begin{document}
raggedright
A pretty short line of regular textlb
A pretty short line of regular textlb
A pretty short line of regular textlb
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line with lettrinelb
A pretty short line of regular textlb
A pretty short line of regular text but way too long to be on one line, so we need to break itlb
A pretty short line of regular textlb
end{document}
In a bigger document, you could define a "lettrine
" for each letter, say:
newcommand{LettrineA}{%
newparshape{4}{0pt}{linewidth}{1}{2.5em}{dimexprlinewidth-2.5em}{1}{0pt}{linewidth}\
raisebox{dimexpr-height+.6baselineskip}[0pt][0pt]{%
resizebox{!}{1.6baselineskip}{A}}%
}
newcommand{LettrineB}{%
% ...
}
answered Dec 6 at 16:51
Werner
434k619531639
434k619531639
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%2f463029%2flettrines-explicit-linebreaks-and-hanging-indents%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