7

If I use \title, then it changes the page style. How do I display information like title, author and date with out make it a title page?

Or how to show header and footer on title page?

The code is bad since I learn this yesterday.

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{titlesec}

%set page header and footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Com S 311: Homework 1}
\chead{Daolin Cheng}
\rhead{\today}
%\cfoot{Page \thepage}


\usepackage[left=4cm,right=4cm,top=4cm,bottom=4cm]{geometry}


\titlelabel{\thetitle}% reduce the space after section title
%\titleformat{\subsection}[runin]
%{\normalfont\large\bfseries}{\thesubsection}{1em}{} %text can follow subsection title




\begin{document}
%\pagestyle{fancy}
%\fancypagestyle{plain}


\renewcommand{\footrulewidth}{0.4pt}% default is 0pt





\section*{Problem 1}
\renewcommand{\thesubsection}{\alph{subsection}}

\subsection{) $12|\mathbb{N}\subseteq3|\mathbb{N}$} 

Proof:



\subsection{) $35|\mathbb{N}=5|\mathbb{N}\cap7|\mathbb{N}$} Proof:



%\newpage
\section*{Problem 2}
For arbitrary sets A, B, prove:
\setcounter{subsection}{0}%reset numbering
\subsection{) $A\cup B=B\Longleftrightarrow A\subseteq B$}
\subsection{) $A\cap B=B\Longleftrightarrow B\subseteq A$}
\subsection{) $A-(A-B)\subseteq B$}
\vspace*{1\baselineskip} %add one blank line
And prove there exists sets A,B such that:
\subsection{) $B\nsubseteq A-(A-B)$}
\section*{Problem 3}
Give an example of a function $f:\mathbb{Z}\rightarrow\mathbb{N}$ that is both one-to-            one and onto.
\section*{Problem 4}
Let $f:\mathbb{Z}\rightarrow\mathbb{Z}$ be a function defined as $f(x)=3x+7$. Prove:
\setcounter{subsection}{0}%reset numbering
\subsection{) $f$ is one-to-one}
\subsection{) $f$ is NOT onto}

\section*{Problem 5}
Let $\sim$ be a relation over the real numbers such that for $a,b\in\mathbb{R}, a\sim b$     if and only if $a-b\in\mathbb{Z}$. Prove that $\sim$ is an equivalence relation.


\section*{Problem 6}
Use the well-ordering principle to prove that proofs by induction are valid. More     precisely, prove that if: $P:\mathbb{N}\rightarrow \{T,F\}$ is a predicate with the     following properties,
\renewcommand{\thesubsection}{\arabic{subsection}}
\setcounter{subsection}{0} %reset numbering
\titleformat{\subsection}[block]{\hspace{2em}}{\thesubsection}{1pt}{.\quad} %add     indent, space after number and text followed
\subsection{$P(0)=T$}
\subsection{$P(n)=T\Rightarrow P(n+1)=T$}
then $\forall n\in\mathbb{N}, P(n)=T$.


\section*{Problem 7}
\renewcommand{\thesubsection}{\alph{subsection}}    
\setcounter{subsection}{0} %reset numbering
\titleformat{\subsection}[block]{\hspace{2em}}{\thesubsection}{1pt}{)\quad}
\subsection{$\forall n \in \mathbb{Z}^+$,}
$$1+3+5+\cdots+2n-1=n^2$$
\subsection{$\forall n \in \mathbb{Z}^+$,}
$$3^n>2^n$$
\subsection{$\forall n \in \mathbb{Z}^+$,}
$$\sum_{i=1}^ni=\frac{n(n+1)}{2}$$
\subsection{$\forall n \in \mathbb{Z}^+$,}
\begin{center}
$n^3+2n$ is divisible by 3
\end{center}




\section*{Bonus Problem}
\paragraph{\indent}%add indent to paragraph
A friend of yours challenges you to a game skittles. The game requires two piles each     containing exactly N skittles. On a player's turn, the player removes some (non-zero) number of skittles from exactly one of the piles. The player that takes the last skittle, wins!
\paragraph{\indent}
Your friend decides to go first. Describe a strategy that ensures that you will always win. Prove its correctness using induction.




\end{document}
  • What code do you currently have? – digitalextremist Jan 18 '14 at 21:48
  • Your example doesn't show the problem you're currently experiencing with so-called \title... Please update. – Werner Jan 19 '14 at 7:08
  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jan 19 '14 at 16:37
  • Let me suggest improvements to your code. Use \renewcommand{\thesubsection}{\alph{subsection})} and omit the )-s in the subsection titles. Use \indent, then a newline, to start an indented paragraph. \paragraph is for printing the paragraph title. – marczellm Jan 19 '14 at 19:44
  • Related: tex.stackexchange.com/questions/44280/… – lockstep Jan 21 '14 at 9:05
9

You can just issue \thispagestyle immediately after \maketitle:

Sample output

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{titlesec}

%set page header and footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Com S 311: Homework 1}
\chead{First Last}
\rhead{\today}

\usepackage[left=4cm,right=4cm,top=4cm,bottom=4cm]{geometry}

\titlelabel{\thetitle\enspace}

\begin{document}
\title{Homework 1}
\author{First Last}
\maketitle
\thispagestyle{fancy}

\section*{Problem 1}
\renewcommand{\thesubsection}{\alph{subsection})}

\subsection{$12|\mathbb{N}\subseteq3|\mathbb{N}$} 

Proof:

\subsection{$35|\mathbb{N}=5|\mathbb{N}\cap7|\mathbb{N}$} Proof:

\newpage
\section*{Problem 2}
For arbitrary sets A, B, prove:
\setcounter{subsection}{0}%reset numbering
\subsection{$A\cup B=B\Longleftrightarrow A\subseteq B$}
\subsection{$A\cap B=B\Longleftrightarrow B\subseteq A$}
\subsection{$A-(A-B)\subseteq B$}
\vspace*{1\baselineskip} %add one blank line
And prove there exists sets A,B such that:
\subsection{$B\nsubseteq A-(A-B)$}

\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.