File size generated from Pdflatex is too big
Use ghostscript to compress your PDF.
gswin64c -dCompatibilityLevel=1.5 -dAutoRotatePages=/None -dQUIET -sDEVICE=pdfwrite -o "out.pdf" "in.pdf"
I got 19.38KB.
It's not sure it will be longer for an assignment: most of the size comes from font embedding in pdf, which does not really depends on what you put in your file.
That said, I've made a little test with your MWE, changing the compiler or the font encoding: with OT1 encoding:
- latex+dvips+ps2pdf: 22 KB
- latex+dvipdfmx: 13.34 KB
- pdflatex: 49.84 KB
- lualatex: 49.37 KB
- xelatex: 13.2 KB
With T1 encoding and loading the Latin Modern fonts
- latex+dvips+ps2pdf: 22.57 KB
- latex+dvipdfmx: 13.66 KB
- pdflatex: 99.95 KB
- lualatex: 49.37 KB
- xelatex: 13.65 KB
I can't explain these differences between a direct way to .pdf (pdflatex, lualatex) and the way through dvi or xdvi. Perhaps in one case all glyphs are embedded, and in the other, only the necessary glyphs are embedded? That would explain the very different sizes for the pdflatex way between T1 and OT1 font encoding: Latin Modern has much more glyphs than Computer Modern.
You can limit the size by avoiding font inclusion as much as possible and rely on the PDF viewer to supply the fonts, although this practice is discouraged even for the “standard 35” Adobe fonts, nowadays.
Write the file nodownload.map
next to your main document
phvb8r Helvetica-Bold 0 "TeXBase1Encoding ReEncodeFont" <8r.enc
phvb8y Helvetica-Bold 0 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
phvbo8r Helvetica-BoldOblique 64 "TeXBase1Encoding ReEncodeFont" <8r.enc
phvbo8y Helvetica-BoldOblique 64 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
phvr8r Helvetica 0 "TeXBase1Encoding ReEncodeFont" <8r.enc
phvr8y Helvetica 0 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
phvro8r Helvetica-Oblique 64 "TeXBase1Encoding ReEncodeFont" <8r.enc
phvro8y Helvetica-Oblique 64 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
psyr Symbol 3
ptmb8r Times-Bold 2 "TeXBase1Encoding ReEncodeFont" <8r.enc
ptmb8y Times-Bold 2 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
ptmbi8r Times-BoldItalic 66 "TeXBase1Encoding ReEncodeFont" <8r.enc
ptmbi8y Times-BoldItalic 66 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
ptmr8r Times-Roman 2 "TeXBase1Encoding ReEncodeFont" <8r.enc
ptmr8y Times-Roman 2 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
ptmri8r Times-Italic 66 "TeXBase1Encoding ReEncodeFont" <8r.enc
ptmri8y Times-Italic 66 "TeXnANSIEncoding ReEncodeFont" <texnansi.enc
Now compiling the following example
\pdfmapfile{=nodownload.map}
\documentclass[10pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage[scaled]{helvet}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lipsum}
\title{Test}
\author{John doe}
\begin{document}
\maketitle
\section{This is a test}
\textsf{Abc\itshape def} and an integral
\[
\int_{-\infty}^{\infty}e^{-x^{2}}\,dx=\sqrt{\pi}
\]
\lipsum
\end{document}
produces, for me, a 29 KiB PDF file. To be sure the compression is as high as possible, add the line
\pdfcompresslevel=9
at the beginning, although this shouldn't be necessary.
But 50 KiB for a PDF file is too strict a requirement in any case. I tried pasting the “lipsum” text in a word processor I happen to own (not that one) and print it to a PDF file. Fonts are included even if Times is used.