JDMCreator / LaTeXTableEditor

readme
MIT License
139 stars 13 forks source link

Middle Align is not acting properly #26

Closed Warborn123 closed 3 years ago

Warborn123 commented 4 years ago
% \usepackage{array}
\begin{table}
\centering
\begin{tabular}{|>{\centering\hspace{0pt}}p{0.088\linewidth}|>{\centering\hspace{0pt}}p{0.271\linewidth}|>{\centering\hspace{0pt}}p{0.267\linewidth}|>{\centering\arraybackslash\hspace{0pt}}p{0.31\linewidth}|} 
\hline
\textbf{Basis for comparison}  & \textbf{Conduction}  & \textbf{Convection}  & \textbf{Radiation}  \\ 
\hline
Meaning & Conduction is a process in which transfer of heat takes place between objects by direct contact. & Convection refers to the form of heat transfer in which energy transition occurs within the fluid. & Radition alludes to the mechanism in which heat is transmitted without any physical contact between objects. \\ 
\hline
Represent & How heat travels between objects in direct contact. & How heat passes through fluids. & How heat flows through empty spaces. \\ 
\hline
Cause & Due to temperature difference. & Due to density difference. & Occurs from all objects, at temperature greater than 0 K. \\ 
\hline
Occurence & Occurs in solids, through molecular collisions. & Occurs in fluids, by actual flow of matter. & Occurs at a distance and does not heats the intervening substance. \\ 
\hline
Transfer of heat & Uses heated solid substance. & Uses intermediate substance. & Uses electromagnetic waves. \\ 
\hline
Speed & Slow & Slow & Fast \\ 
\hline
Law of reflection and refraction & Does not follow & Does not follow & Follow \\
\hline
\end{tabular}
\end{table}

This is my code for a table with middle align, and when I paste this to my tex file, all the text in the cell are top aligned. Please fix this.

Warborn123 commented 4 years ago

Also, could we get a feature like selecting different part of the table to be top/middle/bottom aligned in the future? Thank you.

JDMCreator commented 4 years ago

Could you paste the JSON code associated to your table? To do so, in the table editor, select File > Generate JSON.

Warborn123 commented 4 years ago

Could you paste the JSON code associated to your table? To do so, in the table editor, select File > Generate JSON.

Of course.

{
    "options": {
        "latex-whitespace": true,
        "latex-border": true,
        "latex-split": false,
        "latex-landscape": false,
        "latex-float": true,
        "fit-table": "sc-sh",
        "latex-hhline": false,
        "latex-hhline-hash": true,
        "latex-tabu": false,
        "latex-microfix-alignment": true,
        "tex-escape": true,
        "tex-macro": true,
        "html-indent": "tab",
        "html-tbody": false,
        "html-remove-tag": false,
        "csv-separator": ",",
        "bbcode-header": "1",
        "pretext-indent": "two",
        "context-split": false,
        "context-landscape": false,
        "context-float": true,
        "context-indent": "two",
        "wml-indent": "four"
    },
    "autoBooktabs": false,
    "caption": {
        "caption": "",
        "numbered": true,
        "label": ""
    },
    "cells": [
        [
            {
                "dataset": {
                    "align": "c",
                    "borderTop": "normal",
                    "borderBottom": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "<b>Basis for comparison</b>          ",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderTop": "normal",
                    "borderBottom": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "<b>Conduction</b>                                                                                                   ",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderTop": "normal",
                    "borderBottom": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "<b>Convection</b>                                                                                                     ",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderTop": "normal",
                    "borderBottom": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "<b>Radiation</b>                                                                                                                ",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Meaning",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Conduction is a process in which transfer of heat takes place between objects by direct contact.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Convection refers to the form of heat transfer in which energy transition occurs within the fluid.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Radition alludes to the mechanism in which heat is transmitted without any physical contact between objects.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Represent",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "How heat travels between objects in direct contact.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "How heat passes through fluids.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "How heat flows through empty spaces.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Cause",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Due to temperature difference.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Due to density difference.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Occurs from all objects, at temperature greater than 0 K.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Occurence",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Occurs in solids, through molecular collisions.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Occurs in fluids, by actual flow of matter.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Occurs at a distance and does not heats the intervening substance.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Transfer of heat",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Uses heated solid substance.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Uses intermediate substance.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Uses electromagnetic waves.",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "borderLeft": "normal",
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal"
                },
                "html": "Speed",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Slow",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Slow",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "borderRight": "normal",
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal"
                },
                "html": "Fast",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ],
        [
            {
                "dataset": {
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "Law of reflection and refraction",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "Does not follow",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "Does not follow",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            },
            {
                "dataset": {
                    "align": "c",
                    "borderBottom": "normal",
                    "borderTop": "normal",
                    "borderLeft": "normal",
                    "borderRight": "normal"
                },
                "html": "Follow",
                "css": "border-width: 1px; border-style: solid; border-color: rgb(0, 0, 0);"
            }
        ]
    ],
    "version": "2.0.1"
}
JDMCreator commented 4 years ago

Interesting issue. There are so many options in this generator that whenever I add a feature, I can't test everything.

In this case, the "Shrink" option generate "paragraph-type" cells instead of "inline-type" cells. Paragraph-type cells are, by default, top-aligned and inline-type cells are, by default, middle-aligned.

In the meantime, you can replace any p{...} code in your preamble by m{...}. Your preamble should look like this :

...
\begin{tabular}{|>{\centering\hspace{0pt}}m{0.088\linewidth}|>{\centering\hspace{0pt}}m{0.271\linewidth}|>{\centering\hspace{0pt}}m{0.267\linewidth}|>{\centering\arraybackslash\hspace{0pt}}m{0.31\linewidth}|} 
...

I will need several days to fix this issue because of the way the code is written.

Warborn123 commented 4 years ago
\begin{tabular}{|>{\centering\hspace{0pt}}m{0.088\linewidth}|>{\centering\hspace{0pt}}m{0.271\linewidth}|>{\centering\hspace{0pt}}m{0.267\linewidth}|>{\centering\arraybackslash\hspace{0pt}}m{0.31\linewidth}|}

Oh, I see. That works. Thank you for your help! Appreciate it.

JDMCreator commented 4 years ago

About your question regarding selecting different parts of the cells, you can use CTRL + Click or SHIFT + Click to select multiple cells. You can also click on row/column number to select the row/column.

Warborn123 commented 4 years ago

About your question regarding selecting different parts of the cells, you can use CTRL + Click or SHIFT + Click to select multiple cells. You can also click on row/column number to select the row/column.

I see, thank you.