我在之前的章节中也遇到过这种情况,但似乎是内联数学与段落分开导致的。现在没有内联数学可以负责,我不确定是什么导致了这种情况。
以下是该问题的本地标记:
\subsection{Using the REPL}
REPL is an acronym short for Read-Eval-Print Loop. REPLs are interactive programming environments where you can input code, have it evaluated by the language implementation, and see the result. They originated with \texttt{Lisp} but are now common to modern programming languages including Haskell.
\index{REPL ! Read-eval-print loop}
\index{REPL}
\index{Lisp}
Assuming you've completed your installation, you should be able to open your terminal or command prompt, enter \texttt{ghci}, hit enter, and see something like the following:
\index{GHCi}
\begin{verbatim}
GHCi, version 7.8.3
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>
\end{verbatim}
It might not be exactly the same, depending on your configuration, but it should be very similar. If you are just downloading GHC for the first time, you may have the newest release number, which is 7.10.1. The newest version includes some important changes which we will cover in due time.
Now try entering some simple arithmetic at your prompt:
\begin{verbatim}
Prelude> 2 + 2
4
Prelude> 7 < 9
True
Prelude> 10 ^ 2
100
\end{verbatim}
If you can enter simple equations at the prompt and get the expected results, congratulations --- you are now a functional programmer! More to the point, your REPL is working well and you are ready to proceed.
To exit GHCi, use the command \texttt{:quit} or \texttt{:q}.
\subsubsection{Abbreviating GHCi commands}
Throughout the book, we'll be using GHCi commands, such as \texttt{:quit} and \texttt{:info} in the REPL. We will present them in the text spelled out, but they can generally be abbreviated to just the colon and the first letter. That is, \texttt{:quit} becomes \texttt{:q}, \texttt{:info} becomes \texttt{:i} and so forth. It's good to type the word out the first few times you use it, to help you remember what the abbreviation stands for, but as you remember the commands, we will start abbreviating them and you will, too.
以下是我们标题中与布局相关的内容(我认为):
\documentclass[9pt, twoside, openany]{memoir}
\linespread{1.20}
\setstocksize{9.25in}{7.5in}
\settrimmedsize{9.25in}{7.5in}{*}
\setlrmarginsandblock{1.5in}{*}{*}
\setulmarginsandblock{1in}{*}{*}
\setlength\cftsectionnumwidth{4em}
\checkandfixthelayout
\usepackage{epigraph}
\usepackage{parskip}
\usepackage[compact]{titlesec}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage[expansion=true, protrusion=true]{microtype}
\usepackage{librebaskerville}
\setmonofont{Ubuntu Mono}
\setlength\partopsep{-\topsep}
\addtolength\partopsep{-\parskip}
\addtolength\partopsep{0.0cm}
\setlength{\parskip}{8pt}
\setlength{\parindent}{0pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \fontsize{50}{60}\thechapter}{20pt}{\HUGE}
\titleformat*{\section}{\Huge}
\titleformat*{\subsection}{\Large}
\titleformat*{\subsubsection}{\large}
\newcommand*{\sectionpostamble}{}
\newcommand*{\subtitle}[1]{%
\def\sectionpostamble{#1}%
}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}
[\normalfont\small\itshape\raggedright\sectionpostamble
\global\let\sectionpostamble\relax]
\newcommand\Chapter[2]{\chapter[#1]{#1\\[2ex]\Large\itshape#2}}
\usepackage{minted}
%% \usemintedstyle{trac}
\usemintedstyle{bw}
%% matches margins with verbatim
\newminted[code]{haskell}{xleftmargin=0cm,
samepage=true,
baselinestretch=1.25,
fontsize=\normalsize}
\makeatletter
\def\verbatim@font{\linespread{1.25}\normalsize\ttfamily}
\makeatother
\usepackage{csquotes}
如果有人知道是什么原因造成的,我将不胜感激。
我添加了一个 MWE,它表现出部分(但不是全部)这种行为。
\documentclass[9pt, twoside, openany]{memoir}
\linespread{1.20}
\setstocksize{9.25in}{7.5in}
\settrimmedsize{9.25in}{7.5in}{*}
\setlrmarginsandblock{1.5in}{*}{*}
\setulmarginsandblock{1in}{*}{*}
\setlength\cftsectionnumwidth{4em}
\checkandfixthelayout
\usepackage{epigraph}
\usepackage{parskip}
\usepackage[compact]{titlesec}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage[expansion=true, protrusion=true]{microtype}
\usepackage{librebaskerville}
\setmonofont{Ubuntu Mono}
\setlength\partopsep{-\topsep}
\addtolength\partopsep{-\parskip}
\addtolength\partopsep{0.0cm}
\setlength{\parskip}{8pt}
\setlength{\parindent}{0pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \fontsize{50}{60}\thechapter}{20pt}{\HUGE}
\titleformat*{\section}{\Huge}
\titleformat*{\subsection}{\Large}
\titleformat*{\subsubsection}{\large}
\newcommand*{\sectionpostamble}{}
\newcommand*{\subtitle}[1]{%
\def\sectionpostamble{#1}%
}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}
[\normalfont\small\itshape\raggedright\sectionpostamble
\global\let\sectionpostamble\relax]
\newcommand\Chapter[2]{\chapter[#1]{#1\\[2ex]\Large\itshape#2}}
%% \usepackage{minted}
%% \usemintedstyle{trac}
%% \usemintedstyle{bw}
%% matches margins with verbatim
%% \newminted[code]{haskell}{xleftmargin=0cm,
%% samepage=true,
%% baselinestretch=1.25,
%% fontsize=\normalsize}
\makeatletter
\def\verbatim@font{\linespread{1.25}\normalsize\ttfamily}
\makeatother
\usepackage{csquotes}
%% \raggedbottomsection
\begin{document}
\title{Haskell Programming from first principles}
%% \frontmatter
%% \pagenumbering{arabic}
%% \setcounter{page}{2}
%% \newcounter{ogpagenumber}
%% \setcounter{ogpagenumber}{\number\value{page}}
\mainmatter
%% \setcounter{page}{\number\value{ogpagenumber}}
%% \Chapter{Hello, Haskell!}{Basic expressions and functions}
%% \epigraph{Functions are beacons of constancy in a sea of turmoil.}{Mike Hammond}
\section{Hello, Haskell}
blah
\subsection{Using the REPL}
REPL is an acronym short for Read-Eval-Print Loop. REPLs are interactive programming environments where you can input code, have it evaluated by the language implementation, and see the result. They originated with \texttt{Lisp} but are now common to modern programming languages including Haskell.
\index{REPL ! Read-eval-print loop}
\index{REPL}
\index{Lisp}
Assuming you've completed your installation, you should be able to open your terminal or command prompt, enter \texttt{ghci}, hit enter, and see something like the following:
\index{GHCi}
\begin{verbatim}
GHCi, version 7.8.3
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>
\end{verbatim}
It might not be exactly the same, depending on your configuration, but it should be very similar. If you are just downloading GHC for the first time, you may have the newest release number, which is 7.10.1. The newest version includes some important changes which we will cover in due time.
Now try entering some simple arithmetic at your prompt:
\begin{verbatim}
Prelude> 2 + 2
4
Prelude> 7 < 9
True
Prelude> 10 ^ 2
100
\end{verbatim}
If you can enter simple equations at the prompt and get the expected results, congratulations --- you are now a functional programmer! More to the point, your REPL is working well and you are ready to proceed.
To exit GHCi, use the command \texttt{:quit} or \texttt{:q}.
\subsubsection{Abbreviating GHCi commands}
Throughout the book, we'll be using GHCi commands, such as \texttt{:quit} and \texttt{:info} in the REPL. We will present them in the text spelled out, but they can generally be abbreviated to just the colon and the first letter. That is, \texttt{:quit} becomes \texttt{:q}, \texttt{:info} becomes \texttt{:i} and so forth. It's good to type the word out the first few times you use it, to help you remember what the abbreviation stands for, but as you remember the commands, we will start abbreviating them and you will, too.
\subsection{Saving scripts and loading them}
As nice as REPLs are, usually you want to store code in a file so you can build it incrementally. Almost all nontrivial programming you do will involve editing libraries or applications made of nested directories containing files with Haskell code in them. The basic process is to have the code and imports (more on that later) in a file, load it into the REPL, and interact with it there as you're building, modifying, and testing it.
You'll need a file named \texttt{test.hs}. The \texttt{.hs} file extension denotes a Haskell source code file. Depending on your setup and the workflow you're comfortable with, you can make a file by that name and then open it in your text editor or you can open your text editor, open a new file, and then save the file with that file name.
Then enter the following code into the file and save it:
\index{source code ! file}
\index{denotation ! denotes}
\end{document}