子阵列的 bmatrix 超出边距

子阵列的 bmatrix 超出边距

我有以下可重现的代码片段

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\title{test}
\author{spanos.nikolaos }
\date{July 2020}

\begin{document}

\maketitle

\textbf{Replace the sequence of tokens per trainable column by the relative array of embeddings, using as map the output of the previous step}\newline
For example the column actors, which has the following structure\newline
['tom hanks', 'tim allen', 'don rickles', 'jim varney', 'wallace shawn', 'john ratzenberger', 'annie potts', 'john morris', 'erik von detten', 'laurie metcalf', 'r. lee ermey', 'sarah freeman', 'penn jillette', 'jack angel', 'spencer aste']
\begin{center}
    $\,\Big\downarrow\,$
\end{center}
\begin{bmatrix} 
[-0.30834767, &-0.26681098, &-0.2173222,  &-0.11151562, &-0.27951762, \ldots x_i = 300],\\
[-0.1721798, &-0.25406063, &-0.38693774, &-0.19798501, &-0.257399, &-0.05970115 \ldots, x_i = 300],\\
[-0.2399106, &-0.21202469, &-0.28024384, &-0.2577843, &-0.257399,\ldots x_i = 300] \\ \ldots (m=15)
\end{bmatrix}
\ \\

\end{document}

输出如下, 在此处输入图片描述

正如您所猜想的那样,我想删除任何额外的空间并将其保留在边距内。提前感谢您的任何建议。

答案1

像这样吗?

在此处输入图片描述

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools,siunitx}

\title{test}
\author{spanos.nikolaos }
\date{July 2020}

\setlength\parindent{0pt}
\setlength\arraycolsep{3pt} % default: 5pt
\begin{document}

\maketitle

\textbf{Replace the sequence of tokens per trainable 
column by the relative array of embeddings, using as 
map the output of the previous step}

% enable rounding to 4 digits after decimal marker:
\sisetup{table-format=-1.4,  
         round-mode=places,
         round-precision=4}
         
For example the column actors, which has the 
following structure

['tom hanks', 'tim allen', 'don rickles', 
 'jim varney', 'wallace shawn', 'john ratzenberger', 
 'annie potts', 'john morris', 'erik von detten', 
 'laurie metcalf', 'r. lee ermey', 'sarah freeman', 
 'penn jillette', 'jack angel', 'spencer aste']
\begin{gather*}
\Big\downarrow \\
\begin{bmatrix*}[l]
[\begin{array}{@{} *{5}{S} l @{}}
-0.30834767 &-0.26681098 &-0.2173222  &-0.11151562 &-0.27951762 &\ldots\ x_i = 300
\end{array}] \\
[\begin{array}{@{} *{6}{S} l @{}}
-0.1721798  &-0.25406063 &-0.38693774 &-0.19798501 &-0.257399 &-0.05970115 &\ldots\ x_i = 300
\end{array}] \\
[\begin{array}{@{} *{5}{S} l @{}}
-0.2399106  &-0.21202469 &-0.28024384 &-0.2577843  &-0.257399 &\ldots\ x_i = 300 \\ 
\end{array}] \\
\vdots\ (m=15) \\
\end{bmatrix*}
\end{gather*}

\end{document}

答案2

我的例子只是对你的代码的改进,特别是对于我不明白的矩阵。对不起。你还可以看到包的不同之处: parskipgeometry(用于边距)和用于\mbox \footnotesize获得一个小矩阵。这是一个解决方案,但肯定不是最好的。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{parskip}
\usepackage[margin=3cm]{geometry}
\title{test}
\author{spanos.nikolaos}
\date{July 2020}

\begin{document}

\maketitle

\textbf{Replace the sequence of tokens per trainable column by the relative array of embeddings, using as map the output of the previous step.}

For example the column actors, which has the following structure:

['tom hanks', 'tim allen', 'don rickles', 'jim varney', 'wallace shawn', 'john ratzenberger', 'annie potts', 'john morris', 'erik von detten', 'laurie metcalf', 'r. lee ermey', 'sarah freeman', 'penn jillette', 'jack angel', 'spencer aste']

\[\Big\downarrow\]
\[\mbox{\footnotesize$
\begin{bmatrix} 
-0.30834767, &-0.26681098, &-0.2173222,  &-0.11151562, &-0.27951762 & \ldots& x_i = 300\\
-0.1721798, &-0.25406063, &-0.38693774, &-0.19798501, &-0.257399, &-0.05970115 & \ldots & x_i = 300\\
-0.2399106, &-0.21202469, &-0.28024384, &-0.2577843, &-0.257399,& \ldots &x_i = 300\\ 
\ldots (m=15) &
\end{bmatrix}$}
\]
\end{document}

在此处输入图片描述

相关内容