4

I want to right justify the dates in the resume below. My failed attempts are shown.

What I show below converts, but the dates are not right justified.

I used how do we right align part of a line in r markdown? and that worked for pdf, but MS Word doesn't seem to right align the text.

Long term goals: I am using markdown and pandoc. I want to create a resume using markdown. I want to be able to export it to docx and pdf. My editor is emacs and I am using Markdown mode and have pandoc installed. I use C-c / O to set the file to docx, the C-c / r to run Pandoc. I am open to having a style file.

---
Font:Tahoma
---

# Summary
Ten years experience solving problems

# Experience

## First Job, Newark, NJ        <span align="right"> (5/2014-Present) </span>
### Programmer
* Solved analysis problems using data automation.

## Second Job, Newark, NJ      \hfill (01/01/04/2014) 
### Data Analyst
* Debugged Programs.
Harlan Nelson
  • 1,394
  • 1
  • 10
  • 22
  • For the Word version, have you tried going markdown -> HTML -> Word doc using Pandoc instead of just markdown -> Word doc? – Matthew Strawbridge Feb 19 '18 at 21:58
  • I just tried that. It took me a while to figure out the no-break space, but the html worked but the docx did not. pandoc -s -o resume_question.html resume_question.md pandoc -s -o resume_question.docx resume_question.html – Harlan Nelson Feb 19 '18 at 22:44
  • Probably not what you want to hear, but your best bet would probably be to just create your resume in Word and then save as PDF from there to get both formats with all the styling preserved. – Matthew Strawbridge Feb 20 '18 at 08:00
  • not a very nice solution but in pandoc markdown.. you can use    all the way. its actually html 4 spaces which is accepted in pandoc pdf compilation – mirageglobe Apr 27 '19 at 08:21

3 Answers3

3

It is most likely not possible.

First, the original Markdown rules state:

HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

That being the case, things like left-aligning text is outside the scope of Markdown. Of course, the appropriate way to do that is to use raw HTML, as you have tried. But that's were you run into problems with Pandoc.

Pandoc's documentation states (emphasis added):

Because pandoc’s intermediate representation of a document is less expressive than many of the formats it converts between, one should not expect perfect conversions between every format and every other. Pandoc attempts to preserve the structural elements of a document, but not formatting details such as margin size. And some document elements, such as complex tables, may not fit into pandoc’s simple document model. While conversions from pandoc’s Markdown to all formats aspire to be perfect, conversions from formats more expressive than pandoc’s Markdown can be expected to be lossy.

As left-aligning text is not something you can do in plain Markdown, then it is the sort of thing you can expect to get lost when converting to other formats. The reason it works when converting to HTML is that the raw HTML is simply passed through unaltered. Standard Markdown behavior it to not even parse the HTML. As the output is HTML this works. However, when using Pandoc to convert from Markdown to non-HTML formats, the "formatting details" in the raw HTML is lost.

Sometimes you can successful convert from an HTML document to another format with a little more success, but the supported features outside of Markdown are severely limited. From time to time I have seen people even attempt to create the Word document they want, then use Pandoc to convert that to HTML to see what Pandoc produces. Even then, in most cases the formatting is lost as it is not something that can be conveyed in plain Markdown.

tarleb
  • 19,863
  • 4
  • 51
  • 80
Waylan
  • 37,164
  • 12
  • 83
  • 109
  • I understand that markdown is supposed to be mostly format free. I was hoping there was a way to inject formatting dependent on the output format. Right tabs are a little obscure. But I learned a lot. I was under the impression that you could push everything through some type of template that would apply the formats. – Harlan Nelson Feb 20 '18 at 20:48
  • @HarlanNelson see the `--reference-doc` option and https://pandoc.org/MANUAL.html#custom-styles-in-docx-output – mb21 Feb 22 '18 at 14:07
  • @mb21 Thanks, this looks like what I need. I need to make a reference.docx and also figure out what custom-style for a right tab is in Word. If I had that, it would answer my question. – Harlan Nelson Feb 22 '18 at 15:05
3

A solution for pandoc, which is probably not the best idea (as markdown does not support alignment) is using "emsp;" which stands for html emphasis space; on top of &nbsp. You can think of it as \t tabs.

the markdown would be :

## First Job, Newark, NJ &emsp;&emsp;&emsp;&emsp;&emsp;&emsp; (5/2014-Present)
### Programmer
## Second Job, Newark, NJ &emsp;&emsp;&emsp;&emsp;&emsp;&emsp; (01/01/04/2014) 
### Data Analyst
* Debugged Programs.

resulting :

## First Job, Newark, NJ                        (5/2014-Present)
### Programmer
## Second Job, Newark, NJ                        (01/01/04/2014) 
### Data Analyst
* Debugged Programs.

if you wish to have it precisely flushed just make sure you use the right font (fixed width types).

hope this helps.

mirageglobe
  • 2,446
  • 2
  • 24
  • 30
2

You should try this, it works perfectly:

---
Font:Tahoma
---

# Summary
Ten years experience solving problems

# \textcolor{blue}{Experience}

## First Job, Newark, NJ       \textcolor{red}{\hfill (5/2014-Present)}
### Programmer

* Solved analysis problems using data automation.

## Second Job, Newark, NJ      \hfill (01/01/04/2014) 
### Data Analyst

* Debugged Programs.

You can further adjust colors with:
# Summary
Ten years experience solving problems

# Experience

## First Job, Newark, NJ        \hfill (5/2014-Present) 
### Programmer

* Solved analysis problems using data automation.

## Second Job, Newark, NJ      \hfill (01/01/04/2014) 
### Data Analyst

* Debugged Programs.

https://i.stack.imgur.com/7XVMG.png

DavidW
  • 29,336
  • 6
  • 55
  • 86