I am using a finite element program that outputs data in .txt
files. And I want to input these data in my LaTeX code. Is there a way to input the data files so that they appear as the program output format?
Program output data file:
LaTeX code:
\documentclass[a4paper,oneside,openany,article]{memoir}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[danish]{babel}
\usepackage{graphicx}
\graphicspath{{Figures/}}
\usepackage{fullpage}
\usepackage{mathtools}
\begin{document}
\input{Data/shearwall_only_bc_A.txt}
\end{document}
LaTeX output:
Best Answer
In addition to
listings
, thefancyvrb
package is equally suitable for this purpose.This package provides the
\VerbatimInput
command (similar to\verbatiminput
), which can be customised using various parameters (e.g., reducing font size).Notes:
|
and(
/)
as the escape character and argument delimiters means these symbols cannot appear as part of the verbatim text (or in this case, the contents ofdata.txt
);data.txt
was removed by specifying*
as the comment character (similar to%
in LaTeX);(|color(Green) 8 400.519E-33 -12. 17.1429 27.3494E+03)