xelatex + tabular: align a cell to character and skip entering that char in certain rows












2















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?










share|improve this question


















  • 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 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











  • 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
















2















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?










share|improve this question


















  • 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 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











  • 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














2












2








2


0






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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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











  • 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














  • 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 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











  • 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








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










3 Answers
3






active

oldest

votes


















1














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}


enter image description here



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}


enter image description here






share|improve this answer


























  • 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 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





    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



















1














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}


enter image description here



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}


enter image description here






share|improve this answer


























  • 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











  • @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





















0














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.



enter image description here






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    1














    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer


























    • 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 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





      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
















    1














    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer


























    • 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 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





      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














    1












    1








    1







    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer















    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}


    enter image description here



    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}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    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 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 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





      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











    • 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








    • 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











    1














    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer


























    • 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











    • @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


















    1














    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer


























    • 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











    • @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
















    1












    1








    1







    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}


    enter image description here



    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}


    enter image description here






    share|improve this answer















    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}


    enter image description here



    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}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    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 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 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











    • 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 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













    0














    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.



    enter image description here






    share|improve this answer




























      0














      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.



      enter image description here






      share|improve this answer


























        0












        0








        0







        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.



        enter image description here






        share|improve this answer













        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.



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 13 at 21:32









        egregegreg

        728k8819233233




        728k8819233233






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?