# Is there any software that converts latex file to tex file?

I was asked to convert a file from LaTeX format to TeX format, so it could be compiled by TeX. I use LaTeX a lot, but I'm quite unfamiliar with TeX. And the file is pretty long. So I was wondering if there's software or trick could simplify a bit the task.

BTW, I haven't installed TeX on my Ubuntu machine because I think I can use pdftex to test if the file is compatible with TeX. Am I right?

Edit:

The reason that I need to do this is that my supervisor asked me to convert something that I wrote with LaTeX into TeX style because he only knows how to use TeX. So the file should not only be compiled by TeX, but the grammar should also be TeX style so my supervisor could understand and modify it.

-
LaTeX is written in TeX so you can (with a bit of effort) just simply \input latex.ltx at the start of your file and then process it with tex, but it is rather pointless, it just makes the input longer and the processing slower. –  David Carlisle Jan 9 at 16:43
@ablmf It would be worth specifying the 'rules' a bit more tightly here, as David is quite right that you could just input all of LaTeX with a little effort. Presumably you are supposed to use 'plain TeX' as the input format and therefore define any helper macros yourself. –  Joseph Wright Jan 9 at 16:49
Welcome to TeX.sx! –  Andrew Swann Jan 9 at 16:56
Your supervisor should know that plain tex is an example format called "basic macros" in the TeXBook and not intended for document production. It simply has no mechanisms for font handling or cross referencing or anything that you actually need in a modern document. Of course you can define them and people do which is fine, but inputting your own macros to define those things and inputting the latex sources are not really any different conceptually, and the latex sources have been tested rather more over the last 30 years or so –  David Carlisle Jan 9 at 17:47
ask your supervisor for a typical file of his to use as a model. it will almost certainly input some macro files -- perhaps eplain or amstex or manmac, to name several that have been used relatively widely in the past (and are still used by some old-timers). reasonable user documentation is available for at least the first two. also, what field is this in? with that information, you should be able to ask questions that would get more reasonable answers. even so, don't expect this to be a walk in the park. –  barbara beeton Jan 9 at 18:23
show 1 more comment

\def\patterns#1{}
\catcode\{=12
\let\newtoks\relax
\let\dump\relax
\let\+\relax
\input latex.ltx


To a LaTeX file makes it a plain TeX file.

This is a LaTeX answer I gave to a question earlier today which runs without error in pdftex as modified:

\def\patterns#1{}
\catcode\{=12
\let\newtoks\relax
\let\dump\relax
\let\+\relax
\input latex.ltx
\documentclass[a4paper]{IEEEtran}

%\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum,tabularx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Here, main documents begins %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\title{FooBar}

% The paper headers
\markboth{FooBar 2013}%
{FooBar2013}

% make the title area
\maketitle

%% -----------------
%% |   Main part   |
%% -----------------

\lipsum

\section{aaa}
\noindent
\begin{tabularx}{\linewidth}{@{} r X @{}}
Step 1: & \lipsum[1] \\
Step 2: & \lipsum[2] \\
Step 3 ggggggg kk kk jj gg : & \lipsum[3] \\
\end{tabularx}

\makeatletter
\renewcommand*\@IEEEiedmakelabel[1]{\hspace\labelsep
\parbox[t][0pt][t]{\itemindent}{\raggedright\normalfont\bfseries #1}}
\makeatother
\section{bbb}

\begin{description}

\item[Step 1]
\lipsum[1]
\item[Step 2]
\lipsum[2]
\item[Step 3 ggggggg kk kk jj gg ]
\lipsum[3]
\end{description}

\makeatletter
\renewcommand*\@IEEEiedmakelabel[1]{\hspace\labelsep
\makebox[\linewidth][l]{{\normalfont\bfseries #1}}}
\makeatother
\section{bbb}

\begin{description}

\item[Step 1]
\lipsum[1]
\item[Step 2]
\lipsum[2]
\item[Step 3 ggggggg kk kk jj gg ]
\lipsum[3]
\end{description}

\end{document}

-
WOW! Could you just please elaborate why the first 5 lines are necessary? –  tohecz Jan 9 at 16:55
@tohecz you need to clobber \patterns as that sets up hyphenation and is only allowed in initex runs not typestting runs (just use the hyphenation in plain tex) \dump is similar (that dumps a format but is an error if executed in plain tex) the catcode of { is set back because latex explicitly tests that someone is doing this and gives an error message (as normally inputting latex.ltx into plain tex is a mistake) and the remaining ones are because \outer is a pointless irritant. –  David Carlisle Jan 9 at 17:00
Instead of using the pre-generated latex.fmt, you include the whole latex source at the beginning of the document, so it is no surprise it compiles with pdftex, but I think this is not the spirit of the question, since the syntax used in all document except the first six lines, is latex syntax (i.e: \begin/\end environments, font changing commands, sectioning commands, etc.) –  JLDiaz Jan 10 at 11:54
@JLDiaz but that is the point of the answer. As noted in the other answer the spirit of the question is not well defined. plain has no syntax or definitions for cross references or bibliography handling or font changing so any document "using plain tex" has to define some macros for that, and those macros (rather than plain itself) determine the document syntax. The macros I input are no different in principle from including manmac or any other macro set, apart from the fact that people recognise the name and the \begin syntax and have an emotional response that it is latex not plain tex. –  David Carlisle Jan 10 at 12:03
@MartinSchröder There is no difference in principle between this and texbook.tex both input macros (latex.ltx and manmac.tex respectively) and use some markup defined by those macros. As I comment above the macros you input determine the markup used, that is always the case with "plain TeX" files as plain itself has so little document level markup defined. Obviously if you input manmac before this document or latex.ltx before texbook you will get error. You appear to be saying that any document that defines a macro is no longer "plain tex" I do not accept that. –  David Carlisle Jan 10 at 12:49
show 6 more comments

»So the file should not only be compiled by TeX, but the grammar should also be TeX style so my supervisor could understand and modify it.«

I'd be very surprised to see a full solution to this problem. One thing is that TeX can compile a file, but it is a completely other thing to convert LaTeX into readable TeX, which can be handled, revised, changed, amended, in short: be a basis for further writing.

Just as an example:

The line \documentclass[pagesize, parskip=half, headings=big, english, DIV=calc, BCOR=5mm]{scrartcl} contains quite a lot of instructions. How in the world transfer this into plain TeX except including more or less the whole KOMA-script bundle into the file?

Maybe you tell us a bit more about your file and the intentions of your supervisor.

-
This looks like a comment. Would you like to change it into a comment, or do you plan to extend it to a real answer? –  Stefan Kottwitz Jan 9 at 18:16
This is no comment. This is an answer: what the OP would like to do, seems not possible, unfortunately. And to elaborate on the reasons for that, including an example, is not very readable in a comments field, besides that. –  Keks Dose Jan 9 at 18:18