8

I've started using LaTeX a few weeks ago and I really like it.

Now... I have a bunch of MS Word templates (.dotx files) I'd like to convert to LaTeX. Each of these templates basically consists of fonts, header, footer, several paragraph styles, etc.

Is there any tool or procedure I can follow to automate this Word to LaTeX template conversion?

  • 12
    Short answer: No. – Johannes_B Jan 13 '16 at 18:31
  • 3
    These tools are for converting content (and don’t work that well). As far as I know there’s no automatic way to convert layouts/settings. That must be done manually … but there are experts out there (including me) who can do this work for you ;-) – Tobi Jan 13 '16 at 19:08
  • 3
    The .docx to .tex conversion have sense to save contents at the price of obtain dirty code (sometimes very hard to clean). For templates is just better star with a empty file or an existing LaTeX template. Using the blindtext package and playing with some others as geometry and fancyhdr you can obtain a nice template in minutes and check how it look with text. – Fran Jan 13 '16 at 20:16
  • 2
    @sztruks I think your advice is a bit too drastic. While there is something to be said for sticking with basic styles, the fact that mauro has templates in Word with styles already shows that he understands the difference between formatting and content, as that what Word styles are. The average Word user doesn't use styles, which then makes the adaptation to LaTeX difficult. But learning how to make headers and footers and format lists or other sections is quite basic LaTeX use. Converting Word styles (not documents) to LaTeX isn't so hard for a beginner if you understand the concepts. – Alan Munn Jan 13 '16 at 23:35
  • 2
    @mauro -- since you've been successful, when you have a few minutes, it would be helpful to future readers if you could write a self-answer with a few pointers to what steps you actually took to convert your templates. it's nice to hear about a success story. – barbara beeton Jan 15 '16 at 21:35
3

Yes, there is a tool. I just came across GrindEQ while looking for an automatic tool myself:

www.grindeq.com

They have a version that you can install in your computer or an online service for conversion. It is not free though.

  • Welcome to TeX.Stackexchange! – user36296 Nov 22 '18 at 22:59
  • This is a misunderstanding: There are many conversion tools from Word to LaTeX, but the question is how to transfer dot files = templates. – Keks Dose Nov 23 '18 at 9:23
1

This answer addresses a specific subset of the cases which the question might apply to.

In some cases. .dot(x) files are relatively simple but, as pointed out by others, they can be more complex. Moreover, the last time I attempted to deal with such things, they were typically created on the basis of a document. Essentially, you created a document with the stuff you needed and then saved it as a template. You could edit them etc., but that was also quite like editing a document.

So, although you can't directly convert a template, you can use it to create a document and then convert that.

In many cases, it will be better not to do this and to start the LaTeX coding from scratch.

However, there are cases in which it can be useful to convert them because, for example, you are provided with a form in .doc(x) format, and need to complete this form regularly. You could turn this into a .dot(x) - at least, if you have Word, you could do this or, if you are like me, you could use LibreOffice instead. Or you could, if you are sufficiently bloody-minded about the whole thing, insist on converting it to a .tex document which you then treat as a fill-in 'template'. And, bloody-minded or not, you might want to merge data to fill multiple forms and have no idea at all how to do that in a word processor but understand perfectly how to use textmerg. If so, a one-time loss of efficiency in converting the form may easily be worthwhile in terms of saving your time and hair later. The mere knowledge that you do not have to tangle with an alien system over and over again may bring a measure of joy and peace to your existence. The knowledge that you never again need fill in the data on triplicate carbon copies by hand or dive into the Auto-Correct Nightmare may enable you to banish the most insidiously pointless of your bureaucratic traumas.

Now you could make it into a proper class or style. That's The Right Way to LaTeX It. But, frankly, life is sometimes too short to worry overly much about ensuring that institutional forms are created using clean code. Especially when they must look exactly as if they were created in Word in order to be acceptable to the institution.

In these circumstances, automatic conversion and minimal clean-up is the way to go.

In these circumstances, wvware does a very good job of producing messy code which produces PDF which looks every bit as bad as the Word original: too tight spacing, crowded tables with gray, shaded bits in odd configurations: you name it, it converts it.

It probably actually does a better job if the original document is logically constructed. I'm guessing all the \textbf{}s I get reflect real changes in the original document which the converter cannot tell are entirely pointless.

The result is an admirably high-fidelity clone of the original, including all aesthetic and typographical atrocities, and thereby ensuring conformity with the most exacting of institutional requirements.

This conversion software has preserved what little sanity I have in the face of institutional paperwork requirements. I highly recommend it to anybody faced with similar organisational demands.

  • I took the "turn it into a document class and use datatool approach" for a form my department suddenly invented. But although it mimics the Word created document, mine is Just A Little Bit Nicer Looking.™ :) – Alan Munn Jan 15 '16 at 23:51
  • @AlanMunn So is mine, actually. But only in ways which nobody can consciously notice or, therefore, object to. Mine isn't a class. It is basically a .tex document which I copy and modify. Then merge stuff into. I suppose I could make it a class, but I guarantee they'll change the form if I do that ;). (Actually, I have more than one, sadly....) – cfr Jan 16 '16 at 0:23
1

The answers have been given in the comments, but maybe somebody later finds this question and there is a bit more to say than above.

There is no converter software for Word templates (*.dot or .dotx). Of course there is a bunch of solutions how to convert a Word file (.doc or *.docx) to LaTeX code; if you need that, search for word2tex. LibreOffice has an export to LaTeX function, which might be used as well.

The question is about templates, namely *.dotx files.

*.dot(x) files can contain macros, pictures, a complete layout of a flyer, whatever. For each element you have to search for the equivalent package, options and commands in the LaTeX world.

For example take an invoice with carry over from the first to the second page, sent by letter. More or less easy with Word, more difficult with LaTeX.

You'd have to construct the head / layout of the letter, e.g. using the scrletter package.

But the tabular with the carry over were a real problem, if there weren't this wonderfull solution: https://tex.stackexchange.com/a/157193/4736

This might explain why it is close to impossible to write a converter. Maybe in 25 years? No, I don't think that people will use Word then...

  • i think you mean *.doc(x), not *.dot(x). – barbara beeton Jan 15 '16 at 21:30
  • @barbarabeeton Dear Barbara, your comment is precious to me. No, I meant »dot«, but I'm very happy that the editor of TUGboat never ever cared a d*** about Word. – Keks Dose Jan 15 '16 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.