
Ich bin auf ein Problem gestoßen, für das ich keine Lösung zu finden scheine. Ich verwende das Paket, tabularx
da ich mit kleinen Seiten arbeite. Meine Tabelle enthält eine Mischung aus Zahlen und Text und ich möchte, dass die Spalte vertikal ausgerichtet ist.
Wenn Sie hier die 3. oder 8. Zeile prüfen, sind nicht alle Spalten vertikal ausgerichtet. Haben Sie bitte eine Option, sie vertikal auszurichten?
\documentclass[10pt]{article}
\usepackage[paperheight=9.45in,paperwidth=6.69in,margin=0.5in,heightrounded]{geometry}
\synctex=1
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{xcolor}
\usepackage{tabularx,booktabs}
\usepackage{ghsystem}
\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column
\begin{document}
\begin{center}
\begin{tabularx}{0.95\textwidth}{|X|c|c|c|c|}
\hline
Nom & CAS & Masse Molaire & Utilisation & Dangers \\
\hline
Anisole & 100-66-3 & 108.1 & {\color{orange} Synthèse} & \ghspic[scale=0.4]{exclam} \ghspic[scale=0.4]{flame}\\
\hline
Chlorure d’aluminium anhydre & 7446-70-0 & 133.3 & {\color{orange} Synthèse} & \ghspic[scale=0.4]{acid} \\
\hline
Chlorure de Fer anhydre & 7705-08-0 & 162.2 & {\color{orange} Synthèse} & \ghspic[scale=0.4]{acid} \ghspic[scale=0.4]{exclam}\\
\hline
Chlorure d'isobutanoyle & 79-30-1 & 106.5 & {\color{orange} Synthèse} & \ghspic[scale=0.4]{acid} \ghspic[scale=0.4]{flame} \\
\hline
Dichlorométhane sec & 75-30-2 & 84.9 & {\color{orange} Synthèse}, {\color{purple} Lavage} & \ghspic[scale=0.4]{exclam} \ghspic[scale=0.4]{health} \\
\hline
Soude & 1310-73-2 & 40 & {\color{purple} Lavage} & \ghspic[scale=0.4]{acid} \\
\hline
Solution de carbonate de potassium saturée & 584-08-7 & 138.2 & {\color{purple} Lavage} & \ghspic[scale=0.4]{exclam} \\
\hline
Sulfate de sodium anhydre & 7757-82-6 & 142 & {\color{purple} Lavage} & // \\
\hline
Acide chlorhydrique concentrée & 7647-01-0 & 36.5 & {\color{purple} Lavage} & \ghspic[scale=0.4]{acid} \ghspic[scale=0.4]{exclam} \\
\hline
Solution saturée en chlorure d'ammonium & 12125-02-9 & 53.5 & {\color{purple} Lavage} & \ghspic[scale=0.4]{exclam}\\
\hline
Cyclohexane & 110-82-7 & 84.2 & {\color{brown} CCM} & \ghspic[scale=0.4]{exclam} \ghspic[scale=0.4]{flame} \ghspic[scale=0.4]{health} \ghspic[scale=0.4]{aqpol} \\
\hline
Éther diéthylique & 60-29-7 & 74.12 & {\color{brown} CCM} & \ghspic[scale=0.4]{exclam} \ghspic[scale=0.4]{flame} \\
\hline
\end{tabularx}
\end{center}
\end{document}
Hier ist das Ergebnis:
Antwort1
Ich fürchte, das ghsystem
sollte aktualisiert werden, denn mit TeX Live 2022 (aber auch 2021) versucht es
\chemmacros_load_module:n {nomenclature}
aber chemmacros
in den neuesten Versionen wird es verwendet \chemmacros_module_load:n
und es gibt kein nomenclature
Modul mehr.
Ziemlich merkwürdig, da die Pakete vom selben Autor stammen. Und es gibt einen Problembericht auf der GitHub-Site
https://github.com/cgnieder/ghsystem/issues/13
Auf jeden Fall möchten Sie die Grafiksymbole in der letzten Spalte absenken, sodass sie vertikal zentriert sind.
\documentclass[10pt]{article}
\usepackage[paperheight=9.45in,paperwidth=6.69in,margin=0.5in,heightrounded]{geometry}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{xcolor}
\usepackage{tabularx,booktabs}
% fix the error in ghsystem if using TL 2021 or later
\ExplSyntaxOn
\cs_new_protected:Nn \chemmacros_load_module:n { }
\ExplSyntaxOff
\usepackage{ghsystem}
\usepackage{ragged2e}
\newcommand{\cghspic}[2][]{%
\begingroup\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{}}\ghspic[#1]{#2}\end{tabular}%
\endgroup
}
\begin{document}
\begin{center}
\renewcommand\tabularxcolumn[1]{>{\RaggedRight}m{#1}}% for vertical centering text in X column
\begin{tabularx}{0.95\textwidth}{|X|c|c|c|c|}
\hline
Nom & CAS & Masse Molaire & Utilisation & Dangers \\
\hline
Anisole & 100-66-3 & 108.1 & \textcolor{orange}{Synthèse} & \cghspic[scale=0.4]{exclam} \cghspic[scale=0.4]{flame}\\
\hline
Chlorure d’aluminium anhydre & 7446-70-0 & 133.3 & \textcolor{orange}{Synthèse} & \cghspic[scale=0.4]{acid} \\
\hline
Chlorure de Fer anhydre & 7705-08-0 & 162.2 & \textcolor{orange}{Synthèse} & \cghspic[scale=0.4]{acid} \cghspic[scale=0.4]{exclam}\\
\hline
Chlorure d'isobutanoyle & 79-30-1 & 106.5 & \textcolor{orange}{Synthèse} & \cghspic[scale=0.4]{acid} \cghspic[scale=0.4]{flame} \\
\hline
Dichlorométhane sec & 75-30-2 & 84.9 & \textcolor{orange}{Synthèse}, \textcolor{purple}{Lavage} & \cghspic[scale=0.4]{exclam} \cghspic[scale=0.4]{health} \\
\hline
Soude & 1310-73-2 & 40 & \textcolor{purple}{Lavage} & \cghspic[scale=0.4]{acid} \\
\hline
Solution de carbonate de potassium saturée & 584-08-7 & 138.2 & \textcolor{purple}{Lavage} & \cghspic[scale=0.4]{exclam} \\
\hline
Sulfate de sodium anhydre & 7757-82-6 & 142 & \textcolor{purple}{Lavage} & // \\
\hline
Acide chlorhydrique concentrée & 7647-01-0 & 36.5 & \textcolor{purple}{Lavage} & \cghspic[scale=0.4]{acid} \cghspic[scale=0.4]{exclam} \\
\hline
Solution saturée en chlorure d'ammonium & 12125-02-9 & 53.5 & \textcolor{purple}{Lavage} & \cghspic[scale=0.4]{exclam}\\
\hline
Cyclohexane & 110-82-7 & 84.2 & \textcolor{brown}{CCM} & \cghspic[scale=0.4]{exclam} \cghspic[scale=0.4]{flame} \cghspic[scale=0.4]{health} \cghspic[scale=0.4]{aqpol} \\
\hline
Éther diéthylique & 60-29-7 & 74.12 & \textcolor{brown}{CCM} & \cghspic[scale=0.4]{exclam} \cghspic[scale=0.4]{flame} \\
\hline
\end{tabularx}
\end{center}
\end{document}
Ich habe einen \cghspic
Befehl definiert, der die vertikale Zentrierung vornimmt.
Beachten Sie, dass {\color{<color>} text}
besser sein sollte
\textcolor{<color>}{text}
und ich habe den Code entsprechend geändert. Außerdem habe ich \RaggedRight
in der ersten Spalte große Wortzwischenräume vermieden.