TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}
share|improve this question

migrated from stackoverflow.com Jan 19 '14 at 15:23

This question came from our site for professional and enthusiast programmers.

    
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

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{Daolin Cheng}
\rhead{\today}

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

\titlelabel{\thetitle\enspace}

\begin{document}
\title{Homework 1}
\author{Daoline Cheng}
\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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