xelatex + tabular: align a cell to character and skip entering that char in certain rows
In my CV, I list my past (and a recent) jobs. For example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
end{tabular}
However, I worked at some companies for less than a month: for example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Aug 2012} span & Other Work position at Firm\
end{tabular}
The problem with this second example is that the span does not remove the alignment character (i.e. –) from that particular row. So the question is: how do I remove it from selected rows?
tables xetex alignment
add a comment |
In my CV, I list my past (and a recent) jobs. For example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
end{tabular}
However, I worked at some companies for less than a month: for example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Aug 2012} span & Other Work position at Firm\
end{tabular}
The problem with this second example is that the span does not remove the alignment character (i.e. –) from that particular row. So the question is: how do I remove it from selected rows?
tables xetex alignment
2
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
I’ve foundspanin some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.
– tukusejssirs
Mar 13 at 16:50
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
Here’s the particular answer in which I’ve found thespan. … Next time, I include the complete striped-down examples. :)
– tukusejssirs
Mar 13 at 17:25
add a comment |
In my CV, I list my past (and a recent) jobs. For example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
end{tabular}
However, I worked at some companies for less than a month: for example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Aug 2012} span & Other Work position at Firm\
end{tabular}
The problem with this second example is that the span does not remove the alignment character (i.e. –) from that particular row. So the question is: how do I remove it from selected rows?
tables xetex alignment
In my CV, I list my past (and a recent) jobs. For example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
end{tabular}
However, I worked at some companies for less than a month: for example:
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Aug 2012} span & Other Work position at Firm\
end{tabular}
The problem with this second example is that the span does not remove the alignment character (i.e. –) from that particular row. So the question is: how do I remove it from selected rows?
tables xetex alignment
tables xetex alignment
asked Mar 12 at 20:54
tukusejssirstukusejssirs
225
225
2
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
I’ve foundspanin some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.
– tukusejssirs
Mar 13 at 16:50
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
Here’s the particular answer in which I’ve found thespan. … Next time, I include the complete striped-down examples. :)
– tukusejssirs
Mar 13 at 17:25
add a comment |
2
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
I’ve foundspanin some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.
– tukusejssirs
Mar 13 at 16:50
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
Here’s the particular answer in which I’ve found thespan. … Next time, I include the complete striped-down examples. :)
– tukusejssirs
Mar 13 at 17:25
2
2
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
I’ve found
span in some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.– tukusejssirs
Mar 13 at 16:50
I’ve found
span in some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.– tukusejssirs
Mar 13 at 16:50
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
Here’s the particular answer in which I’ve found the
span. … Next time, I include the complete striped-down examples. :)– tukusejssirs
Mar 13 at 17:25
Here’s the particular answer in which I’ve found the
span. … Next time, I include the complete striped-down examples. :)– tukusejssirs
Mar 13 at 17:25
add a comment |
3 Answers
3
active
oldest
votes
span is a low-level tex primitive. In LaTeX you should use multicolumn to change columns styles:
documentclass{book}
begin{document}
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
multicolumn{2}{l|}{emph{Aug 2012}}& Other Work position at Firm\
end{tabular}
end{document}

If you want to right align them in the first cell, you can use phantom to fake the dash:
documentclass{book}
usepackage{array}
begin{document}
begin{tabular}{r@{emph{~–~}}l | p{11cm}}
emph{Jun 2013}& emph{Aug 2013} & Work position at Company\
multicolumn{1}{r@{phantom{emph{~–~}}}}{emph{Jul 2013}}&
&
Other Work position at Firm\
end{tabular}
end{document}

This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as thehfillsolution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.
– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like themyspannew command from the other answer, however, I can’t seem to make it work. What I tried:newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}andnewcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also creatednewcommandmycolsep{~--~}.
– tukusejssirs
Mar 13 at 19:39
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
add a comment |
Whereas the @ specification of the OP's MWE seems to be locked into stone (can't be changed on the fly), the same is not true of the < specification, which is re-evaluated on the fly.
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{letmycolseprelaxspan}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Aug 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

If you want the result left-aligned, and in light of a comment by the OP, I take a slightly altered approach:
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{defmycolsep{phantom{emph{ -- }}}&}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Jul 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution withhfill, however, it would be nice to have the date right-aligned towards themycolsep. What I mean is that all dates are centred at themycolsep. When you use e.g.Jul 2012, which is a bit shorter thanAug 2010, you’ll see what I mean. I have no idea if it can be accomplished.
– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
add a comment |
I'd do it in a different way and with a simpler user level syntax:
documentclass{article}
usepackage[a4paper]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentEnvironment{cvpart}{}
{
setlength{tabcolsep}{0pt}
parnoindent
begin{tabular*}{textwidth}{
r
l
@{extracolsep{fill}} p{11cm}
}
}
{
end{tabular*}
}
NewDocumentCommand{cvrow}{>{SplitArgument{1}{--}}m m}
{
tukus_cvrow:nnn #1 { #2 }
}
cs_new_protected:Nn tukus_cvrow:nnn
{
emph{ tl_trim_spaces:n { #1 } }
tl_if_novalue:nTF { #2 }
{
hphantom{~--~} &
}
{
mbox{~--~} & emph{ tl_trim_spaces:n { #2 } }
}
& #3 \
}
ExplSyntaxOff
begin{document}
begin{cvpart}
cvrow{Jun 2013 -- Aug 2013}{
Work position at Company
Work position at Company
Work position at Company
Work position at Company
Work position at Company
}
cvrow{Jul 2013}{Other Work position at Firm}
end{cvpart}
end{document}
The cvrow command takes two arguments; if the first argument contains --, one branch is followed and the en-dash is printed. Otherwise just the space is allocated.
Adjust the 11cm to suit your text width.

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%2f479168%2fxelatex-tabular-align-a-cell-to-character-and-skip-entering-that-char-in-cert%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
span is a low-level tex primitive. In LaTeX you should use multicolumn to change columns styles:
documentclass{book}
begin{document}
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
multicolumn{2}{l|}{emph{Aug 2012}}& Other Work position at Firm\
end{tabular}
end{document}

If you want to right align them in the first cell, you can use phantom to fake the dash:
documentclass{book}
usepackage{array}
begin{document}
begin{tabular}{r@{emph{~–~}}l | p{11cm}}
emph{Jun 2013}& emph{Aug 2013} & Work position at Company\
multicolumn{1}{r@{phantom{emph{~–~}}}}{emph{Jul 2013}}&
&
Other Work position at Firm\
end{tabular}
end{document}

This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as thehfillsolution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.
– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like themyspannew command from the other answer, however, I can’t seem to make it work. What I tried:newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}andnewcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also creatednewcommandmycolsep{~--~}.
– tukusejssirs
Mar 13 at 19:39
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
add a comment |
span is a low-level tex primitive. In LaTeX you should use multicolumn to change columns styles:
documentclass{book}
begin{document}
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
multicolumn{2}{l|}{emph{Aug 2012}}& Other Work position at Firm\
end{tabular}
end{document}

If you want to right align them in the first cell, you can use phantom to fake the dash:
documentclass{book}
usepackage{array}
begin{document}
begin{tabular}{r@{emph{~–~}}l | p{11cm}}
emph{Jun 2013}& emph{Aug 2013} & Work position at Company\
multicolumn{1}{r@{phantom{emph{~–~}}}}{emph{Jul 2013}}&
&
Other Work position at Firm\
end{tabular}
end{document}

This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as thehfillsolution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.
– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like themyspannew command from the other answer, however, I can’t seem to make it work. What I tried:newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}andnewcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also creatednewcommandmycolsep{~--~}.
– tukusejssirs
Mar 13 at 19:39
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
add a comment |
span is a low-level tex primitive. In LaTeX you should use multicolumn to change columns styles:
documentclass{book}
begin{document}
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
multicolumn{2}{l|}{emph{Aug 2012}}& Other Work position at Firm\
end{tabular}
end{document}

If you want to right align them in the first cell, you can use phantom to fake the dash:
documentclass{book}
usepackage{array}
begin{document}
begin{tabular}{r@{emph{~–~}}l | p{11cm}}
emph{Jun 2013}& emph{Aug 2013} & Work position at Company\
multicolumn{1}{r@{phantom{emph{~–~}}}}{emph{Jul 2013}}&
&
Other Work position at Firm\
end{tabular}
end{document}

span is a low-level tex primitive. In LaTeX you should use multicolumn to change columns styles:
documentclass{book}
begin{document}
begin{tabular}{r@{emph{ – }}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
multicolumn{2}{l|}{emph{Aug 2012}}& Other Work position at Firm\
end{tabular}
end{document}

If you want to right align them in the first cell, you can use phantom to fake the dash:
documentclass{book}
usepackage{array}
begin{document}
begin{tabular}{r@{emph{~–~}}l | p{11cm}}
emph{Jun 2013}& emph{Aug 2013} & Work position at Company\
multicolumn{1}{r@{phantom{emph{~–~}}}}{emph{Jul 2013}}&
&
Other Work position at Firm\
end{tabular}
end{document}

edited Mar 13 at 17:53
answered Mar 13 at 16:57
Ulrike FischerUlrike Fischer
196k8302689
196k8302689
This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as thehfillsolution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.
– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like themyspannew command from the other answer, however, I can’t seem to make it work. What I tried:newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}andnewcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also creatednewcommandmycolsep{~--~}.
– tukusejssirs
Mar 13 at 19:39
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
add a comment |
This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as thehfillsolution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.
– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like themyspannew command from the other answer, however, I can’t seem to make it work. What I tried:newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}andnewcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also creatednewcommandmycolsep{~--~}.
– tukusejssirs
Mar 13 at 19:39
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as the
hfill solution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.– tukusejssirs
Mar 13 at 17:33
This might more correct answer (from the don’t-use-low-level-TeX-primitives point of view) and the output is exactly the same as the
hfill solution of @Steven B Segletes (link). However, this comment of mine still applies to this answer, too.– tukusejssirs
Mar 13 at 17:33
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I added an edit.
– Ulrike Fischer
Mar 13 at 17:54
I like the
myspan new command from the other answer, however, I can’t seem to make it work. What I tried: newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}} and newcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also created newcommandmycolsep{~--~}.– tukusejssirs
Mar 13 at 19:39
I like the
myspan new command from the other answer, however, I can’t seem to make it work. What I tried: newcommandmergecols{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}} and newcommand{mergecols}[1]{defmulticolumn{1}{r@{phantom{mycolsep}}}{#1}}. … Note that I also created newcommandmycolsep{~--~}.– tukusejssirs
Mar 13 at 19:39
1
1
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
If you would stop to use low-level tex (in this case def) you would have less problems. Beside this: don't ask such questions in comments. Ask a new question.
– Ulrike Fischer
Mar 13 at 19:51
add a comment |
Whereas the @ specification of the OP's MWE seems to be locked into stone (can't be changed on the fly), the same is not true of the < specification, which is re-evaluated on the fly.
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{letmycolseprelaxspan}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Aug 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

If you want the result left-aligned, and in light of a comment by the OP, I take a slightly altered approach:
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{defmycolsep{phantom{emph{ -- }}}&}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Jul 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution withhfill, however, it would be nice to have the date right-aligned towards themycolsep. What I mean is that all dates are centred at themycolsep. When you use e.g.Jul 2012, which is a bit shorter thanAug 2010, you’ll see what I mean. I have no idea if it can be accomplished.
– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
add a comment |
Whereas the @ specification of the OP's MWE seems to be locked into stone (can't be changed on the fly), the same is not true of the < specification, which is re-evaluated on the fly.
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{letmycolseprelaxspan}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Aug 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

If you want the result left-aligned, and in light of a comment by the OP, I take a slightly altered approach:
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{defmycolsep{phantom{emph{ -- }}}&}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Jul 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution withhfill, however, it would be nice to have the date right-aligned towards themycolsep. What I mean is that all dates are centred at themycolsep. When you use e.g.Jul 2012, which is a bit shorter thanAug 2010, you’ll see what I mean. I have no idea if it can be accomplished.
– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
add a comment |
Whereas the @ specification of the OP's MWE seems to be locked into stone (can't be changed on the fly), the same is not true of the < specification, which is re-evaluated on the fly.
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{letmycolseprelaxspan}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Aug 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

If you want the result left-aligned, and in light of a comment by the OP, I take a slightly altered approach:
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{defmycolsep{phantom{emph{ -- }}}&}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Jul 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

Whereas the @ specification of the OP's MWE seems to be locked into stone (can't be changed on the fly), the same is not true of the < specification, which is re-evaluated on the fly.
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{letmycolseprelaxspan}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Aug 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

If you want the result left-aligned, and in light of a comment by the OP, I take a slightly altered approach:
documentclass{article}
usepackage{array}
newcommandmycolsep{emph{ -- }}
newcommandmyspan{defmycolsep{phantom{emph{ -- }}}&}
begin{document}
begin{tabular}{r<{mycolsep}@{}l | p{11cm}}
emph{Jun 2013} & emph{Aug 2013} & Work position at Company\
emph{Aug 2012} myspan & Other Work position at Firm\
emph{Jun 2011} & emph{Aug 2011} & Work position at Company\
emph{Jul 2010} myspan & Other Work position at Firm\
end{tabular}
end{document}

edited Mar 13 at 17:26
answered Mar 13 at 13:36
Steven B. SegletesSteven B. Segletes
159k9204411
159k9204411
Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution withhfill, however, it would be nice to have the date right-aligned towards themycolsep. What I mean is that all dates are centred at themycolsep. When you use e.g.Jul 2012, which is a bit shorter thanAug 2010, you’ll see what I mean. I have no idea if it can be accomplished.
– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
add a comment |
Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution withhfill, however, it would be nice to have the date right-aligned towards themycolsep. What I mean is that all dates are centred at themycolsep. When you use e.g.Jul 2012, which is a bit shorter thanAug 2010, you’ll see what I mean. I have no idea if it can be accomplished.
– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
Perfect! Works as expected. :)
– tukusejssirs
Mar 13 at 16:53
I like the solution with
hfill, however, it would be nice to have the date right-aligned towards the mycolsep. What I mean is that all dates are centred at the mycolsep. When you use e.g. Jul 2012, which is a bit shorter than Aug 2010, you’ll see what I mean. I have no idea if it can be accomplished.– tukusejssirs
Mar 13 at 17:16
I like the solution with
hfill, however, it would be nice to have the date right-aligned towards the mycolsep. What I mean is that all dates are centred at the mycolsep. When you use e.g. Jul 2012, which is a bit shorter than Aug 2010, you’ll see what I mean. I have no idea if it can be accomplished.– tukusejssirs
Mar 13 at 17:16
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs That could be tough using this approach. Let me think some more.
– Steven B. Segletes
Mar 13 at 17:23
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
@tukusejssirs Please see my edit. I think it accomplishes what you ask.
– Steven B. Segletes
Mar 13 at 17:27
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
Now it looks as I imagined it! :) … Thank you! :)
– tukusejssirs
Mar 13 at 17:38
add a comment |
I'd do it in a different way and with a simpler user level syntax:
documentclass{article}
usepackage[a4paper]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentEnvironment{cvpart}{}
{
setlength{tabcolsep}{0pt}
parnoindent
begin{tabular*}{textwidth}{
r
l
@{extracolsep{fill}} p{11cm}
}
}
{
end{tabular*}
}
NewDocumentCommand{cvrow}{>{SplitArgument{1}{--}}m m}
{
tukus_cvrow:nnn #1 { #2 }
}
cs_new_protected:Nn tukus_cvrow:nnn
{
emph{ tl_trim_spaces:n { #1 } }
tl_if_novalue:nTF { #2 }
{
hphantom{~--~} &
}
{
mbox{~--~} & emph{ tl_trim_spaces:n { #2 } }
}
& #3 \
}
ExplSyntaxOff
begin{document}
begin{cvpart}
cvrow{Jun 2013 -- Aug 2013}{
Work position at Company
Work position at Company
Work position at Company
Work position at Company
Work position at Company
}
cvrow{Jul 2013}{Other Work position at Firm}
end{cvpart}
end{document}
The cvrow command takes two arguments; if the first argument contains --, one branch is followed and the en-dash is printed. Otherwise just the space is allocated.
Adjust the 11cm to suit your text width.

add a comment |
I'd do it in a different way and with a simpler user level syntax:
documentclass{article}
usepackage[a4paper]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentEnvironment{cvpart}{}
{
setlength{tabcolsep}{0pt}
parnoindent
begin{tabular*}{textwidth}{
r
l
@{extracolsep{fill}} p{11cm}
}
}
{
end{tabular*}
}
NewDocumentCommand{cvrow}{>{SplitArgument{1}{--}}m m}
{
tukus_cvrow:nnn #1 { #2 }
}
cs_new_protected:Nn tukus_cvrow:nnn
{
emph{ tl_trim_spaces:n { #1 } }
tl_if_novalue:nTF { #2 }
{
hphantom{~--~} &
}
{
mbox{~--~} & emph{ tl_trim_spaces:n { #2 } }
}
& #3 \
}
ExplSyntaxOff
begin{document}
begin{cvpart}
cvrow{Jun 2013 -- Aug 2013}{
Work position at Company
Work position at Company
Work position at Company
Work position at Company
Work position at Company
}
cvrow{Jul 2013}{Other Work position at Firm}
end{cvpart}
end{document}
The cvrow command takes two arguments; if the first argument contains --, one branch is followed and the en-dash is printed. Otherwise just the space is allocated.
Adjust the 11cm to suit your text width.

add a comment |
I'd do it in a different way and with a simpler user level syntax:
documentclass{article}
usepackage[a4paper]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentEnvironment{cvpart}{}
{
setlength{tabcolsep}{0pt}
parnoindent
begin{tabular*}{textwidth}{
r
l
@{extracolsep{fill}} p{11cm}
}
}
{
end{tabular*}
}
NewDocumentCommand{cvrow}{>{SplitArgument{1}{--}}m m}
{
tukus_cvrow:nnn #1 { #2 }
}
cs_new_protected:Nn tukus_cvrow:nnn
{
emph{ tl_trim_spaces:n { #1 } }
tl_if_novalue:nTF { #2 }
{
hphantom{~--~} &
}
{
mbox{~--~} & emph{ tl_trim_spaces:n { #2 } }
}
& #3 \
}
ExplSyntaxOff
begin{document}
begin{cvpart}
cvrow{Jun 2013 -- Aug 2013}{
Work position at Company
Work position at Company
Work position at Company
Work position at Company
Work position at Company
}
cvrow{Jul 2013}{Other Work position at Firm}
end{cvpart}
end{document}
The cvrow command takes two arguments; if the first argument contains --, one branch is followed and the en-dash is printed. Otherwise just the space is allocated.
Adjust the 11cm to suit your text width.

I'd do it in a different way and with a simpler user level syntax:
documentclass{article}
usepackage[a4paper]{geometry}
usepackage{xparse}
ExplSyntaxOn
NewDocumentEnvironment{cvpart}{}
{
setlength{tabcolsep}{0pt}
parnoindent
begin{tabular*}{textwidth}{
r
l
@{extracolsep{fill}} p{11cm}
}
}
{
end{tabular*}
}
NewDocumentCommand{cvrow}{>{SplitArgument{1}{--}}m m}
{
tukus_cvrow:nnn #1 { #2 }
}
cs_new_protected:Nn tukus_cvrow:nnn
{
emph{ tl_trim_spaces:n { #1 } }
tl_if_novalue:nTF { #2 }
{
hphantom{~--~} &
}
{
mbox{~--~} & emph{ tl_trim_spaces:n { #2 } }
}
& #3 \
}
ExplSyntaxOff
begin{document}
begin{cvpart}
cvrow{Jun 2013 -- Aug 2013}{
Work position at Company
Work position at Company
Work position at Company
Work position at Company
Work position at Company
}
cvrow{Jul 2013}{Other Work position at Firm}
end{cvpart}
end{document}
The cvrow command takes two arguments; if the first argument contains --, one branch is followed and the en-dash is printed. Otherwise just the space is allocated.
Adjust the 11cm to suit your text width.

answered Mar 13 at 21:32
egregegreg
728k8819233233
728k8819233233
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.
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%2f479168%2fxelatex-tabular-align-a-cell-to-character-and-skip-entering-that-char-in-cert%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
2
Hm. Where do you learned span? Why don't you use multicolumn? But beside this: don't show snippets, make complete examples that can be used for tests.
– Ulrike Fischer
Mar 12 at 21:13
I’ve found
spanin some of the answers here on StackExchange. And on snippets vs complete examples: I just thought the snippets would be enough to show you what I would like to complete.– tukusejssirs
Mar 13 at 16:50
snippets are difficult to test. You always have to add preamble and other stuff first.
– Ulrike Fischer
Mar 13 at 16:59
Here’s the particular answer in which I’ve found the
span. … Next time, I include the complete striped-down examples. :)– tukusejssirs
Mar 13 at 17:25