Один из способов получить то, что вам нужно, - написать программу, которая использует команду file
для создания составного документа разметки:
program define mytex
version 14
local texfile "`1'"
tempname myreadfile mywritefile
file open `mywritefile' using "new_`texfile'", write replace text
file write `mywritefile' "\documentclass[leqno,11pt]{article}" _newline
file write `mywritefile' "\usepackage{booktabs}" _newline
file write `mywritefile' "\usepackage{tabularx}" _newline
file write `mywritefile' "\begin{document}" _newline
file write `mywritefile' _newline
file close `mywritefile'
file open `myreadfile' using "`texfile'", read text
file open `mywritefile' using "new_`texfile'", write append text
file read `myreadfile' line
file write `mywritefile' `"`line'"' _newline
while r(eof) == 0 {
file read `myreadfile' line
file write `mywritefile' `"`line'"' _newline
}
file close `myreadfile'
file close `mywritefile'
file open `mywritefile' using "new_`texfile'", write append text
file write `mywritefile' "\end{document}" _newline
file close `mywritefile'
end
Теперь предположим, что у вас есть estout
-произведенныйTeX
файл example.tex
со следующим содержимым:
. type example.tex
\title{Introduction to \LaTeX{}}
\author{Author's Name}
\maketitle
\begin{abstract}
The abstract text goes here.
\end{abstract}
\section{Introduction}
Here is the text of your introduction.
\begin{equation}
\label{simple_equation}
\alpha = \sqrt{ \beta }
\end{equation}
\subsection{Subsection Heading Here}
Write your subsection text here.
\section{Conclusion}
Write your conclusion here.
Запустив эту маленькую программу, вы получите файл new_example.tex
:
. mytex example.tex
. type new_example.tex
\documentclass[leqno,11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\title{Introduction to \LaTeX{}}
\author{Author's Name}
\maketitle
\begin{abstract}
The abstract text goes here.
\end{abstract}
\section{Introduction}
Here is the text of your introduction.
\begin{equation}
\label{simple_equation}
\alpha = \sqrt{ \beta }
\end{equation}
\subsection{Subsection Heading Here}
Write your subsection text here.
\section{Conclusion}
Write your conclusion here.
\end{document}
Содержимое источника TeX
Файл (от estout
), конечно, может быть любой TeX
разметкой.
РЕДАКТИРОВАТЬ:
Как OP теперь упоминает вВ комментариях estout
есть prehead
и postfoot
опции для добавления текста до и после созданной таблицы.Похоже, что они поддерживают TeX
разметку.
Однако представленное здесь решение является гораздо более гибким (например, для нескольких строк), расширяемым и, конечно, его можно обобщать за пределы estout
.