\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{newtxtext,newtxmath}
\usepackage{graphicx}
\usepackage{listings}
\lstset{language={[LaTeX]TeX},basicstyle=\ttfamily}
\usepackage{subfiles}
\title{Demonstration of the subfiles package}
\begin{document}
This is the main file, with the preamble
\begin{lstlisting}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fullpage}
\usepackage{newtxtext,newtxmath}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{subfiles}
\end{lstlisting}
If you set \texttt{intro.tex} as the main file instead, then only the contents of that file is typeset. It automatically inherits the preamble of this \texttt{main.tex}, via \verb|\documentclass[main]{subfiles}|.
\subfile{intro}
\end{document}