Automatically formatting mesostics
A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.
The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.
I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
This can be achieved, roughly, with the following code:
documentclass[11pt]{memoir}
usepackage{fancyvrb}
usepackage{DejaVuSansMono}
begin{document}
begin{Verbatim}[xleftmargin=-35mm,commandchars=\{}]
neartextbf{L}y napping,
camtextbf{E} a
tappitextbf{N}g,
as textbf{O}f
gently textbf{R}apping,
at my chambtextbf{E}r door.
end{Verbatim}
end{document}
My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).
This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.
So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?
Couple of notes:
A solution in LuaLaTeX would be fine.
In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?
Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.
poetry mesostic
add a comment |
A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.
The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.
I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
This can be achieved, roughly, with the following code:
documentclass[11pt]{memoir}
usepackage{fancyvrb}
usepackage{DejaVuSansMono}
begin{document}
begin{Verbatim}[xleftmargin=-35mm,commandchars=\{}]
neartextbf{L}y napping,
camtextbf{E} a
tappitextbf{N}g,
as textbf{O}f
gently textbf{R}apping,
at my chambtextbf{E}r door.
end{Verbatim}
end{document}
My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).
This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.
So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?
Couple of notes:
A solution in LuaLaTeX would be fine.
In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?
Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.
poetry mesostic
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42
add a comment |
A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.
The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.
I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
This can be achieved, roughly, with the following code:
documentclass[11pt]{memoir}
usepackage{fancyvrb}
usepackage{DejaVuSansMono}
begin{document}
begin{Verbatim}[xleftmargin=-35mm,commandchars=\{}]
neartextbf{L}y napping,
camtextbf{E} a
tappitextbf{N}g,
as textbf{O}f
gently textbf{R}apping,
at my chambtextbf{E}r door.
end{Verbatim}
end{document}
My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).
This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.
So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?
Couple of notes:
A solution in LuaLaTeX would be fine.
In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?
Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.
poetry mesostic
A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.
The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.
I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
This can be achieved, roughly, with the following code:
documentclass[11pt]{memoir}
usepackage{fancyvrb}
usepackage{DejaVuSansMono}
begin{document}
begin{Verbatim}[xleftmargin=-35mm,commandchars=\{}]
neartextbf{L}y napping,
camtextbf{E} a
tappitextbf{N}g,
as textbf{O}f
gently textbf{R}apping,
at my chambtextbf{E}r door.
end{Verbatim}
end{document}
My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).
This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.
So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?
Couple of notes:
A solution in LuaLaTeX would be fine.
In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?
Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.
poetry mesostic
poetry mesostic
edited Jan 19 at 21:37
bfootdav
asked Jan 19 at 20:03
bfootdavbfootdav
6481420
6481420
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42
add a comment |
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42
add a comment |
3 Answers
3
active
oldest
votes
Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.
The following approach splits the input at \
, then builds lines one by one, setting an hbox
where the width of the center letter is measured; the box will then consist of
- a box as wide as half the linewidth minus half the center letter's width, flush right;
- the center letter;
- a box like in step 1, but flush left.
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}
{
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_set:Nn l__mesostic_center_box { textbf{#2} }
hbox_to_wd:nn { linewidth }
{
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
hss #1
}
textbf{#2}
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
#3 hss
}
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
end{document}
Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.
A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \
is added. The main code has been simplified (thanks to jfbu for the idea).
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}[1]
{
#1
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT { x }
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
% check for a trailing \
tl_if_empty:xT { seq_item:Nn l__mesostic_body_seq { -1 } }
{
seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl
}
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_to_wd:nn { linewidth }
{
hss
hbox_to_wd:nn { 0pt } { hss tl_lower_case:n { #1 } }
textbf{tl_upper_case:n { #2 }}
hbox_to_wd:nn { 0pt } { tl_lower_case:n { #3 } hss }
hss
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
begin{mesostic}[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
end{mesostic}
kant[3]
end{document}
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
add a comment |
documentclass{article}
makeatletter
defmesostic@end{end{mesostic}}
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
{noindenthfill%
llap{MakeLowercase{#1}}%
textbf{MakeUppercase{#2}}%
rlap{MakeLowercase{#3}}%
hfillhbox{}par%
expandafter^^M}%
endgroup
newenvironment{mesostic}{parskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercase{endgroupdef~##1~}{%
defmesostic@tmp{##1}%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi}%
}{}
makeatother
begin{document}
blah blah blah
noindent Xdotfill X
begin{mesostic}
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
end{mesostic}
noindent Xdotfill X
blah blah blah
noindent Xdotfill X
begin{mesostic}
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
end{mesostic}
noindent Xdotfill X
blah blah blah
end{document}
And using Xdotfill Xdotfill X
for the extra lines for context:
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
add a comment |
documentclass{article}
makeatletter
letzzfonttextbf
{obeylineseveryeof{noexpand}%
gdefzzz#1{%
catcode`#1activescantokens{defzzzz{gdef#1}}%
zzzz##1^^M{makebox[.5textwidth][l]{zzfont{string#1}##1}par}%
}}
defzz{flushrightobeylines%
letorzzz@Alph{0fiiftrue}}%
defendzz{endflushright}
begin{document}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
renewcommandzzfont[1]{large$mathcal{#1}$}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
end{document}
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define thezzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.
– David Carlisle
Jan 20 at 9:56
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f470926%2fautomatically-formatting-mesostics%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.
The following approach splits the input at \
, then builds lines one by one, setting an hbox
where the width of the center letter is measured; the box will then consist of
- a box as wide as half the linewidth minus half the center letter's width, flush right;
- the center letter;
- a box like in step 1, but flush left.
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}
{
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_set:Nn l__mesostic_center_box { textbf{#2} }
hbox_to_wd:nn { linewidth }
{
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
hss #1
}
textbf{#2}
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
#3 hss
}
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
end{document}
Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.
A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \
is added. The main code has been simplified (thanks to jfbu for the idea).
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}[1]
{
#1
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT { x }
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
% check for a trailing \
tl_if_empty:xT { seq_item:Nn l__mesostic_body_seq { -1 } }
{
seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl
}
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_to_wd:nn { linewidth }
{
hss
hbox_to_wd:nn { 0pt } { hss tl_lower_case:n { #1 } }
textbf{tl_upper_case:n { #2 }}
hbox_to_wd:nn { 0pt } { tl_lower_case:n { #3 } hss }
hss
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
begin{mesostic}[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
end{mesostic}
kant[3]
end{document}
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
add a comment |
Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.
The following approach splits the input at \
, then builds lines one by one, setting an hbox
where the width of the center letter is measured; the box will then consist of
- a box as wide as half the linewidth minus half the center letter's width, flush right;
- the center letter;
- a box like in step 1, but flush left.
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}
{
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_set:Nn l__mesostic_center_box { textbf{#2} }
hbox_to_wd:nn { linewidth }
{
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
hss #1
}
textbf{#2}
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
#3 hss
}
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
end{document}
Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.
A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \
is added. The main code has been simplified (thanks to jfbu for the idea).
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}[1]
{
#1
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT { x }
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
% check for a trailing \
tl_if_empty:xT { seq_item:Nn l__mesostic_body_seq { -1 } }
{
seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl
}
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_to_wd:nn { linewidth }
{
hss
hbox_to_wd:nn { 0pt } { hss tl_lower_case:n { #1 } }
textbf{tl_upper_case:n { #2 }}
hbox_to_wd:nn { 0pt } { tl_lower_case:n { #3 } hss }
hss
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
begin{mesostic}[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
end{mesostic}
kant[3]
end{document}
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
add a comment |
Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.
The following approach splits the input at \
, then builds lines one by one, setting an hbox
where the width of the center letter is measured; the box will then consist of
- a box as wide as half the linewidth minus half the center letter's width, flush right;
- the center letter;
- a box like in step 1, but flush left.
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}
{
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_set:Nn l__mesostic_center_box { textbf{#2} }
hbox_to_wd:nn { linewidth }
{
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
hss #1
}
textbf{#2}
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
#3 hss
}
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
end{document}
Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.
A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \
is added. The main code has been simplified (thanks to jfbu for the idea).
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}[1]
{
#1
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT { x }
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
% check for a trailing \
tl_if_empty:xT { seq_item:Nn l__mesostic_body_seq { -1 } }
{
seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl
}
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_to_wd:nn { linewidth }
{
hss
hbox_to_wd:nn { 0pt } { hss tl_lower_case:n { #1 } }
textbf{tl_upper_case:n { #2 }}
hbox_to_wd:nn { 0pt } { tl_lower_case:n { #3 } hss }
hss
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
begin{mesostic}[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
end{mesostic}
kant[3]
end{document}
Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.
The following approach splits the input at \
, then builds lines one by one, setting an hbox
where the width of the center letter is measured; the box will then consist of
- a box as wide as half the linewidth minus half the center letter's width, flush right;
- the center letter;
- a box like in step 1, but flush left.
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}
{
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_set:Nn l__mesostic_center_box { textbf{#2} }
hbox_to_wd:nn { linewidth }
{
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
hss #1
}
textbf{#2}
hbox_to_wd:nn { (linewidth-box_wd:N l__mesostic_center_box)/2 }
{
#3 hss
}
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
end{document}
Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.
A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \
is added. The main code has been simplified (thanks to jfbu for the idea).
documentclass{article}
usepackage{environ,xparse}
usepackage{kantlipsum} % for context
ExplSyntaxOn
NewEnviron{mesostic}[1]
{
#1
paraddvspace{topsep}
mesostic_build:V BODY
addvspace{topsep}
}
seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT { x }
cs_new_protected:Nn mesostic_build:n
{
seq_set_split:Nnn l__mesostic_body_seq { \ } { #1 }
% check for a trailing \
tl_if_empty:xT { seq_item:Nn l__mesostic_body_seq { -1 } }
{
seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl
}
seq_map_inline:Nn l__mesostic_body_seq
{
__mesostic_line:w ##1 q_stop
}
}
cs_generate_variant:Nn mesostic_build:n { V }
cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop
{
hbox_to_wd:nn { linewidth }
{
hss
hbox_to_wd:nn { 0pt } { hss tl_lower_case:n { #1 } }
textbf{tl_upper_case:n { #2 }}
hbox_to_wd:nn { 0pt } { tl_lower_case:n { #3 } hss }
hss
}
}
ExplSyntaxOff
begin{document}
kant[1]
begin{mesostic}
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
end{mesostic}
kant[2]
begin{mesostic}[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
end{mesostic}
kant[3]
end{document}
edited Jan 19 at 22:59
answered Jan 19 at 22:14
egregegreg
715k8619003187
715k8619003187
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
add a comment |
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.
– bfootdav
Jan 19 at 22:41
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.
– egreg
Jan 19 at 22:45
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.
– bfootdav
Jan 19 at 22:50
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.
– bfootdav
Jan 22 at 4:44
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.
– egreg
Jan 22 at 7:48
add a comment |
documentclass{article}
makeatletter
defmesostic@end{end{mesostic}}
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
{noindenthfill%
llap{MakeLowercase{#1}}%
textbf{MakeUppercase{#2}}%
rlap{MakeLowercase{#3}}%
hfillhbox{}par%
expandafter^^M}%
endgroup
newenvironment{mesostic}{parskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercase{endgroupdef~##1~}{%
defmesostic@tmp{##1}%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi}%
}{}
makeatother
begin{document}
blah blah blah
noindent Xdotfill X
begin{mesostic}
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
end{mesostic}
noindent Xdotfill X
blah blah blah
noindent Xdotfill X
begin{mesostic}
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
end{mesostic}
noindent Xdotfill X
blah blah blah
end{document}
And using Xdotfill Xdotfill X
for the extra lines for context:
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
add a comment |
documentclass{article}
makeatletter
defmesostic@end{end{mesostic}}
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
{noindenthfill%
llap{MakeLowercase{#1}}%
textbf{MakeUppercase{#2}}%
rlap{MakeLowercase{#3}}%
hfillhbox{}par%
expandafter^^M}%
endgroup
newenvironment{mesostic}{parskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercase{endgroupdef~##1~}{%
defmesostic@tmp{##1}%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi}%
}{}
makeatother
begin{document}
blah blah blah
noindent Xdotfill X
begin{mesostic}
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
end{mesostic}
noindent Xdotfill X
blah blah blah
noindent Xdotfill X
begin{mesostic}
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
end{mesostic}
noindent Xdotfill X
blah blah blah
end{document}
And using Xdotfill Xdotfill X
for the extra lines for context:
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
add a comment |
documentclass{article}
makeatletter
defmesostic@end{end{mesostic}}
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
{noindenthfill%
llap{MakeLowercase{#1}}%
textbf{MakeUppercase{#2}}%
rlap{MakeLowercase{#3}}%
hfillhbox{}par%
expandafter^^M}%
endgroup
newenvironment{mesostic}{parskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercase{endgroupdef~##1~}{%
defmesostic@tmp{##1}%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi}%
}{}
makeatother
begin{document}
blah blah blah
noindent Xdotfill X
begin{mesostic}
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
end{mesostic}
noindent Xdotfill X
blah blah blah
noindent Xdotfill X
begin{mesostic}
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
end{mesostic}
noindent Xdotfill X
blah blah blah
end{document}
And using Xdotfill Xdotfill X
for the extra lines for context:
documentclass{article}
makeatletter
defmesostic@end{end{mesostic}}
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
{noindenthfill%
llap{MakeLowercase{#1}}%
textbf{MakeUppercase{#2}}%
rlap{MakeLowercase{#3}}%
hfillhbox{}par%
expandafter^^M}%
endgroup
newenvironment{mesostic}{parskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercase{endgroupdef~##1~}{%
defmesostic@tmp{##1}%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi}%
}{}
makeatother
begin{document}
blah blah blah
noindent Xdotfill X
begin{mesostic}
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
end{mesostic}
noindent Xdotfill X
blah blah blah
noindent Xdotfill X
begin{mesostic}
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
end{mesostic}
noindent Xdotfill X
blah blah blah
end{document}
And using Xdotfill Xdotfill X
for the extra lines for context:
edited Jan 19 at 22:51
answered Jan 19 at 22:45
jfbujfbu
47.2k66149
47.2k66149
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
add a comment |
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.
– jfbu
Jan 19 at 22:55
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
I also illustrated the uppercasing, which seems to have been on OP's list.
– jfbu
Jan 19 at 23:04
add a comment |
documentclass{article}
makeatletter
letzzfonttextbf
{obeylineseveryeof{noexpand}%
gdefzzz#1{%
catcode`#1activescantokens{defzzzz{gdef#1}}%
zzzz##1^^M{makebox[.5textwidth][l]{zzfont{string#1}##1}par}%
}}
defzz{flushrightobeylines%
letorzzz@Alph{0fiiftrue}}%
defendzz{endflushright}
begin{document}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
renewcommandzzfont[1]{large$mathcal{#1}$}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
end{document}
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define thezzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.
– David Carlisle
Jan 20 at 9:56
add a comment |
documentclass{article}
makeatletter
letzzfonttextbf
{obeylineseveryeof{noexpand}%
gdefzzz#1{%
catcode`#1activescantokens{defzzzz{gdef#1}}%
zzzz##1^^M{makebox[.5textwidth][l]{zzfont{string#1}##1}par}%
}}
defzz{flushrightobeylines%
letorzzz@Alph{0fiiftrue}}%
defendzz{endflushright}
begin{document}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
renewcommandzzfont[1]{large$mathcal{#1}$}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
end{document}
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define thezzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.
– David Carlisle
Jan 20 at 9:56
add a comment |
documentclass{article}
makeatletter
letzzfonttextbf
{obeylineseveryeof{noexpand}%
gdefzzz#1{%
catcode`#1activescantokens{defzzzz{gdef#1}}%
zzzz##1^^M{makebox[.5textwidth][l]{zzfont{string#1}##1}par}%
}}
defzz{flushrightobeylines%
letorzzz@Alph{0fiiftrue}}%
defendzz{endflushright}
begin{document}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
renewcommandzzfont[1]{large$mathcal{#1}$}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
end{document}
documentclass{article}
makeatletter
letzzfonttextbf
{obeylineseveryeof{noexpand}%
gdefzzz#1{%
catcode`#1activescantokens{defzzzz{gdef#1}}%
zzzz##1^^M{makebox[.5textwidth][l]{zzfont{string#1}##1}par}%
}}
defzz{flushrightobeylines%
letorzzz@Alph{0fiiftrue}}%
defendzz{endflushright}
begin{document}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
renewcommandzzfont[1]{large$mathcal{#1}$}
begin{zz}
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
end{zz}
end{document}
edited Jan 19 at 23:45
answered Jan 19 at 23:21
David CarlisleDavid Carlisle
487k4111271871
487k4111271871
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define thezzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.
– David Carlisle
Jan 20 at 9:56
add a comment |
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define thezzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.
– David Carlisle
Jan 20 at 9:56
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.
– bfootdav
Jan 19 at 23:29
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever
– David Carlisle
Jan 19 at 23:46
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)
– jfbu
Jan 20 at 8:02
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
not for "chipoter" but your central letters are not exactly centered on line...
– jfbu
Jan 20 at 8:09
@jfbu I know, actually their left edge is on the center. You could define the
zzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.– David Carlisle
Jan 20 at 9:56
@jfbu I know, actually their left edge is on the center. You could define the
zzfont
command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.– David Carlisle
Jan 20 at 9:56
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.
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%2f470926%2fautomatically-formatting-mesostics%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
Can't you use a tabular with 3 columns (and no space between the columns)?
– Ulrike Fischer
Jan 19 at 21:15
I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.
– bfootdav
Jan 19 at 21:21
It should be not so difficult to insert the kerning manually.
– Ulrike Fischer
Jan 19 at 21:31
I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.
– bfootdav
Jan 19 at 21:42