How to write a definition with variants? The Next CEO of Stack OverflowTranslate in-line...
Necessary condition on homology group for a set to be contractible
Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?
Is a distribution that is normal, but highly skewed considered Gaussian?
Is micro rebar a better way to reinforce concrete than rebar?
Flying from Cape Town to England and return to another province
Proper way to express "He disappeared them"
TikZ: How to reverse arrow direction without switching start/end point?
Grabbing quick drinks
Is French Guiana a (hard) EU border?
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
Can you be charged for obstruction for refusing to answer questions?
Why is information "lost" when it got into a black hole?
Is there a way to save my career from absolute disaster?
How to prove a simple equation?
How to invert MapIndexed on a ragged structure? How to construct a tree from rules?
Can MTA send mail via a relay without being told so?
Is it convenient to ask the journal's editor for two additional days to complete a review?
How to edit “Name” property in GCI output?
Does soap repel water?
WOW air has ceased operation, can I get my tickets refunded?
Make solar eclipses exceedingly rare, but still have new moons
Unclear about dynamic binding
How do I align (1) and (2)?
Is it okay to majorly distort historical facts while writing a fiction story?
How to write a definition with variants?
The Next CEO of Stack OverflowTranslate in-line equations to TeX code (Any Package?)Doing def+asdf+{texttt{#1}} where + can be set with a macroAllow macro to end without new lineMultiple vertical rules along text – by using leaders?How to write a parameter-driven macro?Special macro definition (2opt, 1mand)amstex: operator definition errorProblem in a macro definition (plain TeX)Write an unpar macroLaTeX for plain TeX users?“Missing '{' inserted” and “Missing } inserted” with aligned environment
In TeX I can define, say
def1#1 is #2.{#1 & is & #2.\}
and
def2#1 has #2.{#1 & has & #2.\}
with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.
This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.
Can I write a definition depending on, in this case, is/has so I can write
3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.
obtaing the previous results?
Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.
macros plain-tex
add a comment |
In TeX I can define, say
def1#1 is #2.{#1 & is & #2.\}
and
def2#1 has #2.{#1 & has & #2.\}
with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.
This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.
Can I write a definition depending on, in this case, is/has so I can write
3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.
obtaing the previous results?
Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.
macros plain-tex
At the TeX level for anydef
you can have only one parameter text (the#1 is #2.
and#1 has #2.
in your1
and2
respectively).
– ShreevatsaR
45 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago
add a comment |
In TeX I can define, say
def1#1 is #2.{#1 & is & #2.\}
and
def2#1 has #2.{#1 & has & #2.\}
with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.
This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.
Can I write a definition depending on, in this case, is/has so I can write
3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.
obtaing the previous results?
Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.
macros plain-tex
In TeX I can define, say
def1#1 is #2.{#1 & is & #2.\}
and
def2#1 has #2.{#1 & has & #2.\}
with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.
This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.
Can I write a definition depending on, in this case, is/has so I can write
3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.
obtaing the previous results?
Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.
macros plain-tex
macros plain-tex
edited 1 hour ago
Przemysław Scherwentke
asked 1 hour ago
Przemysław ScherwentkePrzemysław Scherwentke
29.9k54795
29.9k54795
At the TeX level for anydef
you can have only one parameter text (the#1 is #2.
and#1 has #2.
in your1
and2
respectively).
– ShreevatsaR
45 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago
add a comment |
At the TeX level for anydef
you can have only one parameter text (the#1 is #2.
and#1 has #2.
in your1
and2
respectively).
– ShreevatsaR
45 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago
At the TeX level for any
def
you can have only one parameter text (the #1 is #2.
and #1 has #2.
in your 1
and 2
respectively).– ShreevatsaR
45 mins ago
At the TeX level for any
def
you can have only one parameter text (the #1 is #2.
and #1 has #2.
in your 1
and 2
respectively).– ShreevatsaR
45 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago
add a comment |
1 Answer
1
active
oldest
votes
A listofitems
approach. Also, listofitems
is available in Plain TeX.
documentclass{article}
usepackage{listofitems}
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
begin{document}
begin{tabular}{|c|c|c|}
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
end{tabular}
end{document}
Similarly done in plain TeX
input listofitems
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
variant Jim Jones is a fictional character.
variant Tim Smith has two brothers.
bye
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at mytabstackengine
package, which useslistofitems
for parsing. It can digest matrices and remember all the cell content for future use.
– Steven B. Segletes
32 mins ago
1
@marmot For example,documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
@PrzemysławScherwentkelistofitems
was developed in response to my ill-fated ctan.org/pkg/getargsgetargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it intolistofitems
.
– Steven B. Segletes
13 mins ago
|
show 3 more comments
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%2f482357%2fhow-to-write-a-definition-with-variants%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A listofitems
approach. Also, listofitems
is available in Plain TeX.
documentclass{article}
usepackage{listofitems}
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
begin{document}
begin{tabular}{|c|c|c|}
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
end{tabular}
end{document}
Similarly done in plain TeX
input listofitems
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
variant Jim Jones is a fictional character.
variant Tim Smith has two brothers.
bye
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at mytabstackengine
package, which useslistofitems
for parsing. It can digest matrices and remember all the cell content for future use.
– Steven B. Segletes
32 mins ago
1
@marmot For example,documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
@PrzemysławScherwentkelistofitems
was developed in response to my ill-fated ctan.org/pkg/getargsgetargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it intolistofitems
.
– Steven B. Segletes
13 mins ago
|
show 3 more comments
A listofitems
approach. Also, listofitems
is available in Plain TeX.
documentclass{article}
usepackage{listofitems}
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
begin{document}
begin{tabular}{|c|c|c|}
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
end{tabular}
end{document}
Similarly done in plain TeX
input listofitems
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
variant Jim Jones is a fictional character.
variant Tim Smith has two brothers.
bye
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at mytabstackengine
package, which useslistofitems
for parsing. It can digest matrices and remember all the cell content for future use.
– Steven B. Segletes
32 mins ago
1
@marmot For example,documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
@PrzemysławScherwentkelistofitems
was developed in response to my ill-fated ctan.org/pkg/getargsgetargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it intolistofitems
.
– Steven B. Segletes
13 mins ago
|
show 3 more comments
A listofitems
approach. Also, listofitems
is available in Plain TeX.
documentclass{article}
usepackage{listofitems}
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
begin{document}
begin{tabular}{|c|c|c|}
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
end{tabular}
end{document}
Similarly done in plain TeX
input listofitems
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
variant Jim Jones is a fictional character.
variant Tim Smith has two brothers.
bye
A listofitems
approach. Also, listofitems
is available in Plain TeX.
documentclass{article}
usepackage{listofitems}
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
begin{document}
begin{tabular}{|c|c|c|}
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
end{tabular}
end{document}
Similarly done in plain TeX
input listofitems
defvariant#1.{%
setsepchar{is||has}%
greadlist*varinput{#1}
varinput[1] & varinputsep[1] & varinput[2].
}
variant Jim Jones is a fictional character.
variant Tim Smith has two brothers.
bye
answered 1 hour ago
Steven B. SegletesSteven B. Segletes
160k9204413
160k9204413
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at mytabstackengine
package, which useslistofitems
for parsing. It can digest matrices and remember all the cell content for future use.
– Steven B. Segletes
32 mins ago
1
@marmot For example,documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
@PrzemysławScherwentkelistofitems
was developed in response to my ill-fated ctan.org/pkg/getargsgetargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it intolistofitems
.
– Steven B. Segletes
13 mins ago
|
show 3 more comments
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at mytabstackengine
package, which useslistofitems
for parsing. It can digest matrices and remember all the cell content for future use.
– Steven B. Segletes
32 mins ago
1
@marmot For example,documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
@PrzemysławScherwentkelistofitems
was developed in response to my ill-fated ctan.org/pkg/getargsgetargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it intolistofitems
.
– Steven B. Segletes
13 mins ago
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)
– Przemysław Scherwentke
51 mins ago
1
1
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.
– Steven B. Segletes
47 mins ago
1
1
@marmot I am not sure what you mean by "teach" in this context. However, look also at my
tabstackengine
package, which uses listofitems
for parsing. It can digest matrices and remember all the cell content for future use.– Steven B. Segletes
32 mins ago
@marmot I am not sure what you mean by "teach" in this context. However, look also at my
tabstackengine
package, which uses listofitems
for parsing. It can digest matrices and remember all the cell content for future use.– Steven B. Segletes
32 mins ago
1
1
@marmot For example,
documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
@marmot For example,
documentclass{article} usepackage[T1]{fontenc} usepackage{listofitems} setsepchar{\/&} begin{document} readlist*myarray{x11&y12&z13\x21&y22&z_{23}\x31&y32&z33} Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandafter{myarray[2,3]} end{document}
– Steven B. Segletes
20 mins ago
1
1
@PrzemysławScherwentke
listofitems
was developed in response to my ill-fated ctan.org/pkg/getargs getargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems
.– Steven B. Segletes
13 mins ago
@PrzemysławScherwentke
listofitems
was developed in response to my ill-fated ctan.org/pkg/getargs getargs
package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems
.– Steven B. Segletes
13 mins ago
|
show 3 more comments
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%2f482357%2fhow-to-write-a-definition-with-variants%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
At the TeX level for any
def
you can have only one parameter text (the#1 is #2.
and#1 has #2.
in your1
and2
respectively).– ShreevatsaR
45 mins ago
@ShreevatsaR That's why I am asking how to extend this possibility.
– Przemysław Scherwentke
25 mins ago