当前位置:网站首页>[latex] production of complex tables: excel2latex and detail adjustment
[latex] production of complex tables: excel2latex and detail adjustment
2022-07-04 02:56:00 【Mr.zwX】
Just started to use LaTeX Write a paper , The first hurdle encountered is drawing tables , Smaller ordinary tables can be implemented with simple syntax , But the large and complex forms make me unable to start .
Excel2LaTeX plug-in unit
Here is a very handy tool I use :Excel2LaTeX plug-in unit , Download address : Portal
Once you download it , stay excel It shows that add-in , And will Excel2LaTeX.xla File import to add-in in , Restart excel You can see the following options :
stay Excel Draw tables and generate LaTeX Code
Now you can start in excel Draw the desired table form , Here's an example ( Multiple data sets 、 Multiple models 、 Multiple indicators 、 Contains a thick border 、 Bold font 、 Double border, etc ):
then , Using mouse Select generate LaTeX Table area of code , Click on the top left Convert Tabel to LaTeX. Usually I'm used to checking Booktabs package This option , Then copy .
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{
table}[htbp]
\centering
\caption{
Add caption}
\begin{
tabular}{
c|lrrrrrrrrr}
\toprule
\multicolumn{
2}{
c}{
\multirow{
2}[4]{
*}{
\textbf{
Method}}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 1}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 2}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 3}} \\
\cmidrule{
3-11} \multicolumn{
2}{
c}{
} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} \\
\midrule
\multirow{
2}[2]{
*}{
Non-Graph} & MLP & & & & & & & & & \\
& SVR & & & & & & & & & \\
\midrule
\multirow{
5}[2]{
*}{
Graph} & GCN & & & & & & & & & \\
& GAT & & & & & & & & & \\
& RGCN & & & & & & & & & \\
& GIN & & & & & & & & & \\
& ChebNet & & & & & & & & & \\
\midrule
\midrule
\textbf{
Proposed} & \textbf{
ABC} & & & & & & & & & \\
\bottomrule
\end{
tabular}%
\label{
tab:addlabel}%
\end{
table}%
Paste the code into LaTeX In the words of , Pay attention to adding macro package :\usepackage{Booktabs}, Otherwise it will compile incorrectly ! meanwhile , I used a multi row table , So you need to add \usepackage{multirow}.
Now the effect is as follows , The whole picture of the table has been outlined :
Modify and adjust the table format
Adjust the distance from the table title to the table
stay \centering Add... Below \setlength The order of :
\begin{
table}[htbp]
\centering
\setlength{
\abovecaptionskip}{
2pt}%
\setlength{
\belowcaptionskip}{
10pt}%
\caption{
It is a table.}

The effect is as follows :
The vertical line of the table is changed from discontinuous to continuous
What we need to know is ,hline bottomrule toprule Separate the table horizontally , Use in table code bottomrule and toprule Will cause vertical line discontinuity . The solution is : take Except for the top and bottom bottomrule and toprule, All changed to hline. Why don't the top and bottom ones be changed to hline? The reason is that , I need to keep the top and bottom borders bold ! and hline It's a thin line .
If you finally find , The top and bottom of the vertical line are still not closely intersected with the border , then Put the top code \toprule Change it to \bottomrule, Put the code at the bottom \bottomrule Change it to \toprule.
The effect is as follows :
Will three Dataset The horizontal line below separates
In the generated LaTeX In the code ,Dataset The horizontal line code below is as follows :
\cmidrule{
3-11}
This is obviously a complete horizontal line , Now let's introduce how to divide it into three paragraphs .
Change the above code to :
\cmidrule(r){
3-5} \cmidrule(r){
6-8} \cmidrule{
9-11}
A complete horizontal line can be divided into three sections , The effect is as follows :
Text wrapping inside table cells
If the text inside the table is too long , How to manually wrap lines ?LaTeX There is no way to pass directly Enter or \\ The symbol realizes the line break of the text inside the table cell . My method is as follows :
First , Add new commands at the beginning of the article :\newcommand{\tabincell}[2]{\begin{tabular}{@{}#[email protected]{}}#2\end{tabular}}
Then I can wrap in the cell where I want to wrap , For example, I want you to Tabular Learning Methods from Learning Wrap after , It can be modified as follows :\tabincell{c}{Tabular Learning\\Methods}, The effect is as follows :
The final table effect

The complete code is as follows :
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{
table}[htbp]
\centering
\setlength{
\abovecaptionskip}{
2pt}%
\setlength{
\belowcaptionskip}{
10pt}%
\caption{
It is a table.}
\begin{
tabular}{
c|lrrrrrrrrr}
\bottomrule %\toprule
\multicolumn{
2}{
c}{
\multirow{
2}[4]{
*}{
\textbf{
Method}}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 1}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 2}} & \multicolumn{
3}{
c}{
\textbf{
Dataset 3}} \\
\cmidrule(r){
3-5} \cmidrule(r){
6-8} \cmidrule{
9-11} \multicolumn{
2}{
c}{
} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} & \multicolumn{
1}{
c}{
RMSE} & \multicolumn{
1}{
c}{
MAE} & \multicolumn{
1}{
c}{
ACC} \\
\hline
\multirow{
2}[2]{
*}{
Non-Graph} & MLP & & & & & & & & & \\
& SVR & & & & & & & & & \\
\hline
\multirow{
5}[2]{
*}{
Graph} & GCN & & & & & & & & & \\
& GAT & & & & & & & & & \\
& RGCN & & & & & & & & & \\
& GIN & & & & & & & & & \\
& ChebNet & & & & & & & & & \\
\hline
\hline
\textbf{
Proposed} & \textbf{
ABC} & & & & & & & & & \\
\toprule %\bottomrule
\end{
tabular}%
\label{
tab:addlabel}%
\end{
table}%
边栏推荐
- Ai aide à la recherche de plagiat dans le design artistique! L'équipe du professeur Liu Fang a été embauchée par ACM mm, une conférence multimédia de haut niveau.
- 1day vulnerability pushback skills practice (3)
- Fudan released its first review paper on the construction and application of multimodal knowledge atlas, comprehensively describing the existing mmkg technology system and progress
- The "message withdrawal" of a push message push, one click traceless message withdrawal makes the operation no longer difficult
- The first spring of the new year | a full set of property management application templates are presented, and Bi construction is "out of the box"
- Johnson–Lindenstrauss Lemma
- Talking about custom conditions and handling errors in MySQL Foundation
- Is online futures account opening safe and reliable? Which domestic futures company is better?
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- The difference between MCU serial communication and parallel communication and the understanding of UART
猜你喜欢

Practical multifunctional toolbox wechat applet source code / support traffic master

LV1 previous life archives

Tsinghua University product: penalty gradient norm improves generalization of deep learning model

Network byte order

150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan

FRP intranet penetration

Buuctf QR code

Li Chuang EDA learning notes 13: electrical network for drawing schematic diagram

(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)

Package and download 10 sets of Apple CMS templates / download the source code of Apple CMS video and film website
随机推荐
Short math guide for latex by Michael downs
96% of the collected traffic is prevented by bubble mart of cloud hosting
SQL injection (1) -- determine whether there are SQL injection vulnerabilities
Properties of binary trees (numerical aspects)
Safety tips - seat belt suddenly fails to pull? High speed police remind you how to use safety belts in a standardized way
Unity controls the selection of the previous and next characters
Love and self-discipline and strive to live a core life
C # learning notes: structure of CS documents
Save Private Ryan - map building + voltage dp+deque+ shortest circuit
16. System and process information
Question C: Huffman tree
[untitled] the relationship between the metauniverse and digital collections
Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader
On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
Data collection and summary
Advanced learning of MySQL -- Application -- storage engine
WordPress collection WordPress hang up collection plug-in
How to use STR function of C language
Advanced learning of MySQL -- Application -- index
Mysql to PostgreSQL real-time data synchronization practice sharing