我想A。与昨天一样{w | w begins ...
,我找到了一个使用一些命令来设置的解决方案subsection title
,但今天我找不到它,因为我不记得命令名称了。如果能提供参考链接,我将不胜感激。谢谢。
最小示例
\documentclass[10pt,letterpaper]{article}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{ntheorem}
\usepackage{polynomial}
\usepackage{layouts}
\usepackage{enumerate}
\usepackage[version=0.96]{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,backgrounds,petri,positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.footprints}
\usetikzlibrary{shadows}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\usepackage[bookmarksopen,bookmarksdepth=3]{hyperref}
\usepackage{titlesec}
\usepackage{xcolor}
%define new colors
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
%set up color for table of contents
\hypersetup{
colorlinks, linkcolor={medium-blue},
citecolor={dark-blue}, urlcolor={medium-blue}
}
\usepackage{tocloft}
%title
\title{\textbf{Solution for Chapter 1}}
\begin{document}
\setlength{\cftsecnumwidth}{3em} % Set numwidth of section
\setlength{\cftsubsecnumwidth}{6em} % Make subsection numwidth the same as section
\setlength{\cftsubsecindent}{\cftsecindent} % Make subsection indent the same as section
\tableofcontents
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\maketitle
\phantomsection
\section*{1.1}
\addcontentsline{toc}{section}{\numberline{1.1}The following are the state diagrams for two DFAs, $M_1$, and $M_2$. Answer the following question
about each of these machines.}
The following are the state diagrams for two DFAs, $M_1$, and $M_2$. Answer the following question
about each of these machines.\\
\begin{tikzpicture}[shorten >=1pt, node distance=2cm,auto,on grid,initial text=, every state/.style={minimum size=3mm,draw=blue!50,very thick,fill=blue!20}]
\begin{scope}
\node[state,initial] (q_1) {$q_1$};
\node[state,accepting] (q_2) [right=of q_1] {$q_2$};
\node[state] (q_3) [below right=of q_1] {$q_3$};
\path[->]
(q_1) edge [bend left] node {a} (q_2)
(q_1) edge [loop above] node {b} (q_1)
(q_2) edge [bend left] node {a,b} (q_3)
(q_3) edge [bend left] node {a} (q_2)
(q_3) edge [bend left] node {b} (q_1);
\node [below=1cm, align=flush center,text width=8cm] at (q_3)
{
$M_1$
};
\end{scope}
\begin{scope}[xshift=8cm]
\node[state,initial,accepting] (q_1) {$q_1$};
\node[state] (q_2) [right=of q_1] {$q_2$};
\node[state] (q_3) [below=of q_1] {$q_3$};
\node[state,,accepting] (q_4) [below=of q_2] {$q_4$};
\path[->]
(q_1) edge [bend left] node {a} (q_2)
(q_1) edge [loop above] node {b} (q_1)
(q_2) edge [bend left] node {a} (q_3)
(q_2) edge [bend left] node {b} (q_4)
(q_3) edge [bend left] node {b} (q_1)
(q_3) edge [bend left] node {a} (q_2)
(q_4) edge [loop below] node {b} (q_4)
(q_4) edge [bend left] node {a} (q_3)
;
\node [below=1cm, align=flush center,text width=8cm] at (q_3)
{
$M_2$
};
\end{scope}
\end{tikzpicture}
\textbf{Solution}\\
\phantomsection
\subsection*{a.}
\addcontentsline{toc}{subsection}{\numberline{}a. What is the start state?}
What is the start state?\\
$M_1$ start states: $q_1$\\
$M_2$ start states: $q_1$\\
\phantomsection
\subsection*{b.}
\addcontentsline{toc}{subsection}{\numberline{}b. What is the set of accept states?}
What is the set of accept states?\\
$M_1$ accepting states: $q_2$\\
$M_2$ accepting states: $q_1, q_4$\\
\phantomsection
\subsection*{c.}
\addcontentsline{toc}{subsection}{\numberline{}c. What sequence of states does the machine go through on input $aabc$}
What sequence of states does the machine go through on input $aabc$?\\
$M_1$: $q_1 \rightarrow q_2 \rightarrow q_3 \rightarrow q_1 \rightarrow q_1$\\
$M_2$: $q_1 \rightarrow q_1 \rightarrow q_1 \rightarrow q_2 \rightarrow q_4$\\
\phantomsection
\subsection*{d.}
\addcontentsline{toc}{subsection}{\numberline{}d. Does the machine accept the string $aabb$?}
Does the machine accept the string $aabb$?\\
$M_1$: No because the last state $q_1$ is not an accepting state.\\
$M_2$: Yes because the last state $q_4$ is an accepting state.\\
\phantomsection
\subsection*{e.}
\addcontentsline{toc}{subsection}{\numberline{}e. Does the machine accept the string $\varepsilon$?}
Does the machine accept the string $\varepsilon$?\\
No, both of them do not accept string $\varepsilon$.
\end{document}
答案1
是这帖子有帮助吗?
\usepackage{titlesec}
\titleformat{\subsection}[runin]{\normalfont\bfseries}{\thesubsection.}{3pt}{}