我的代码中不断出现 \hbox badness 错误。行 (-.97,-1.37,-1.37) 也缩进,我不知道如何修复它。我只希望输出有两行,然后是一个空格,然后是接下来的两行等。
\section{Part 2}
(-1.03, 2.87) decodes as 0100 \\
(-3.28, -1.21) decodes as 0011 - together, 01000011 gives "C"\\
(-0.97, -2.71) decodes as 0110\\
(2.21, -0.95) decodes as 1011 - together, 01101011 gives "k"\\
\textbf{Probable error} \\
\textbf{Probable intended bit sequence: 01101111 “o”}\\
(-1.37, -1.48) decodes as 0111\\
(-2.86, -2.51) decodes as 0010 - together, 01110010 gives "r"\\
(-1.37, -2.73) decodes as 0110\\
(1.22, -3.17) decodes as 1110 - together, 01101110 gives "n"\\
答案1
请始终提供可编译代码。老实说,我不知道这是否真的适用于您的示例,因为我不知道还发生了什么。盲目猜测……
\documentclass{article}
\begin{document}
\section{Part 2}
\begin{flushleft}
(-1.03, 2.87) decodes as 0100 \\
(-3.28, -1.21) decodes as 0011 - together, 01000011 gives ``C''\\[1\baselineskip]
(-0.97, -2.71) decodes as 0110\\
(2.21, -0.95) decodes as 1011 - together, 01101011 gives ``k''\\
\textbf{Probable error} \\
\textbf{Probable intended bit sequence: 01101111 ``o''}\\[1\baselineskip]
(-1.37, -1.48) decodes as 0111\\
(-2.86, -2.51) decodes as 0010 - together, 01110010 gives ``r''\\[1\baselineskip]
(-1.37, -2.73) decodes as 0110\\
(1.22, -3.17) decodes as 1110 - together, 01101110 gives ``n''\\[1\baselineskip]
\end{flushleft}
\end{document}
请注意,您的原始代码只会产生右双引号。如果您想要花括号,您也需要左双引号。如果不是,您需要使用适当的\text...
命令。但在这种情况下,您可能还是需要某种代码列表标记。
答案2
您应该对您想要隔开的线之间的坐标对和\bigskip
(或者可能只是)使用数学模式。\medskip
我还将连字符改为破折号(连字符仅用于连接单词)并设置等宽字体中的位序列以进行对比。
还附有一张带表格的建议渲染图。
\documentclass{article}
\usepackage{booktabs,siunitx}
\newcommand{\bits}[1]{\texttt{#1}}
\newcommand{\lparen}{(}
\newcommand{\rparen}{)}
\begin{document}
\section{Part 2}
\begin{flushleft}
$(-1.03, 2.87)$ decodes as \bits{0100} \\
$(-3.28, -1.21)$ decodes as \bits{0011} --- together, \bits{01000011} gives ``C''
\bigskip
$(-0.97, -2.71)$ decodes as \bits{0110}\\
$(2.21, -0.95)$ decodes as \bits{1011} --- together, \bits{01101011} gives ``k''\\
\textbf{Probable error} \\
\textbf{Probable intended bit sequence: \bits{01101111} ``o''}
\bigskip
$(-1.37, -1.48)$ decodes as \bits{0111}\\
$(-2.86, -2.51)$ decodes as \bits{0010} --- together, \bits{01110010} gives ``r''
\bigskip
$(-1.37, -2.73)$ decodes as \bits{0110}\\
$(1.22, -3.17)$ decodes as \bits{1110} --- together, \bits{01101110} gives ``n''
\end{flushleft}
\section{Part 2}
\begin{tabular}{
@{}
>{\lparen}S[table-space-text-pre=\lparen,table-format=-1.2]
@{,\,}
S[table-space-text-post=\rparen,table-format=-1.2]<{\rparen}
>{\ttfamily}c
>{\ttfamily}c
c
@{}
}
\toprule
\multicolumn{2}{c}{Point} &
\multicolumn{1}{c}{decodes as} &
\multicolumn{1}{c}{together} &
gives \\
\midrule
-1.03 & 2.87 & 0100 \\
-3.28 & -1.21 & 0011 & 01000011 & C \\
\addlinespace
-0.97 & -2.71 & 0110\\
2.21 & -0.95 & 1011 & 01101011 & k \\
\multicolumn{3}{@{}l}{\bfseries Probable error} \\
\multicolumn{3}{@{}l}{\bfseries Probable intended bit sequence} & 01101111 & \bfseries o\\
\addlinespace
-1.37 & -1.48 & 0111\\
-2.86 & -2.51 & 0010 & 01110010 & r \\
\addlinespace
-1.37 & -2.73 & 0110\\
1.22 & -3.17 & 1110 & 01101110 & n \\
\bottomrule
\end{tabular}
\end{document}