How to rename tables? - latex

I'm writing a paper in Spanish, and I need the name of my tables as "Tabla," not as "Cuadro" which is the current name.
I used the command:
\renewcommand{\tablename}{Tabla}
But it is not working, as nothing changes. I do not have any error when compiling, and the name of my table is still "Cuadro".
\documentclass[journal]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[spanish, english]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
\spanishdecimal{.}
\begin{document}
\renewcommand{\tablename}{Tabla}
\newcommand\Tstrut{\rule{0pt}{2.6ex}}
\newcommand\Bstrut{\rule[-0.9ex]{0pt}{0pt}}
\begin{table}[h!]
\begin{center}
\caption{Title}
\label{label1}
\centering
\begin{tabular}{c}
\hline \rule[-1ex]{0pt}{2.5ex}something A \Tstrut\Bstrut\\
\rule[-1ex]{0pt}{2.5ex} Something B \Tstrut\Bstrut \\
\rule[-1ex]{0pt}{2.5ex}Something C\Tstrut\Bstrut \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}

There is a special option es-tabla for the babel package.
Some other points:
if the main language of your document is Spanish, this should be the last language loaded in the options of the babel package, e.g. after english
the floating specifier [h!] is almost a guarantee for bad image placement, better use something like [htbp]
\documentclass[journal]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[english,spanish,es-tabla]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
\spanishdecimal{.}
\newcommand\Tstrut{\rule{0pt}{2.6ex}}
\newcommand\Bstrut{\rule[-0.9ex]{0pt}{0pt}}
\begin{document}
\begin{table}[htbp]
\begin{center}
\caption{Title}
\label{label1}
\centering
\begin{tabular}{c}
\hline \rule[-1ex]{0pt}{2.5ex}something A \Tstrut\Bstrut\\
\rule[-1ex]{0pt}{2.5ex} Something B \Tstrut\Bstrut \\
\rule[-1ex]{0pt}{2.5ex}Something C\Tstrut\Bstrut \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}

Related

How can I put an equation and an image in the same row? (Latex)

I want to put an equation with cases on the left and its graph on the right, in the same row. I try with different solutions I found on stackoverflow, but any of them could help me. This is the code I wrote in VSC:
\documentclass[12pt]{article}
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{fancyhdr, color}
\usepackage[dvipsnames]{xcolor}
\usepackage[thinc]{esdiff}
\begin{itemize}
\item \textbf{Finestra rettangolare e area unitaria:}
\begin{tabular}{c c}
\begin{equation*} \Pi(t) =
\begin{cases}
1, & -\frac{1}{2} \leq t \leq -\frac{1}{2} \\
0, & altrove \\
\end{cases}
\end{equation*}
&
\includegraphics[scale=0.1]{Rectangular_Function_C.png}
\end{tabular}
But it doesn't work:
Function image
Don't use an equation inside a table cell. You can use inline math like $...$ instead
to vertically align the image with the equation, you can use the valign=m key from the adjustbox package
you shouldn't set multi-letter words in math mode, the kerning will be all wrong. Instead you can use \text{altrove}
\documentclass[12pt]{article}
\usepackage{blindtext}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{fancyhdr, color}
\usepackage[dvipsnames]{xcolor}
\usepackage[thinc]{esdiff}
\usepackage[export]{adjustbox}
\begin{document}
\begin{itemize}
\item \textbf{Finestra rettangolare e area unitaria:}
\begin{tabular}{c c}
$\displaystyle\Pi(t) =
\begin{cases}
1, & -\frac{1}{2} \leq t \leq -\frac{1}{2} \\
0, & \text{altrove} \\
\end{cases}
$
&
\includegraphics[width=3cm,valign=m]{example-image-duck}
\end{tabular}
\end{itemize}
\end{document}

An alternative to write multirow in latex's tabular?

In latex, I know we can use the multirow command like the following,
\begin{table}[!h]
\centering
\begin{tabular}{|c|l|}
\hline
\multirow{2}{*}{A}
& I want to place this sentence in multiple lines, \\
& but don't want to control the linebreak myself \\
\hline
\end{tabular}
\end{table}
I think it is so stupid to control the linebreak myself.
Any other alternative that fits the text width to line width?
\documentclass{article}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabularx}{\linewidth}{|c|X|}
\hline
A
& I want to place this sentence in multiple lines, but don't want to control the linebreak myself \\
\hline
\end{tabularx}
\end{table}
\end{document}

Overfull \hbox (1.38991pt too wide) in paragraph at lines, Latex warning even though PDF is getting generated

This below latex code has warning saying Overfull \hbox (1.38991pt too wide) in paragraph at lines; pdf is getting generated without any issue, I am trying to find out where exactly I am making a mistake to see that warning.
Latex code1:
\begin{document}
\setbeamertemplate{caption}[numbered]
\begin{frame}
\titlepage
\end{frame}
Latex code2:
%\section{Literature Review}%
\begin{frame}{OBJECTIVE}
\begin{table}[h!]
\centering
\begin{tabular}{ p{3cm}|p{7cm}}
\hline
\vspace{1pt}
Title & “CompaRob:The shopping cart assistance robot" \textit{’ Int. J. Distrib. Sensor Netw., vol. 12,no. 2, Feb. 2016, Art. no. 4781280.} \\
\hline
\vspace{6mm}
Methodology &
\begin{itemize}
\item Radio and ultrasound signals
\item Provide freedom of movements for elderly people
\end{itemize}\\
\hline
\vspace{1pt}
Demerit &
\begin{itemize}
\item Not able to show how to find a product
\end{itemize}\\
\hline
\end{tabular}
\end{table}
\end{frame}
There is not enough space to fit 10 cm worth of columns and the default padding before and after the columns. Either remove the padding by using #{}p{2.9cm}|p{7cm}#{} or make the columns a bit smaller:
\documentclass{beamer}
\begin{document}
\setbeamertemplate{caption}[numbered]
\begin{frame}
\titlepage
\end{frame}
%\section{Literature Review}%
\begin{frame}{OBJECTIVE}
\begin{table}[h!]
\centering
\begin{tabular}{ p{2.9cm}|p{7cm}}
\hline
\vspace{1pt}
Title & “CompaRob:The shopping cart assistance robot" \textit{’ Int. J. Distrib. Sensor Netw., vol. 12,no. 2, Feb. 2016, Art. no. 4781280.} \\
\hline
\vspace{6mm}
Methodology &
\begin{itemize}
\item Radio and ultrasound signals
\item Provide freedom of movements for elderly people
\end{itemize}\\
\hline
\vspace{1pt}
Demerit &
\begin{itemize}
\item Not able to show how to find a product
\end{itemize}\\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}

LuaLaTeX: horitontal alignment of verbatim-environments inside a tabularx-environment

First, I'm fully aware that my code is probably not the ideal way to realize what I want to do. However I'm not a professional LaTeX User and this is the way I figured out.
I made a minimal example that hopefully works when compiled(compiler: LuaLaTeX) to display my problem.
I'm trying to make a beamer-frame with a tabularx-table, which contains in-line verbatim-environments on the one hand and equation-environments on the other. The "Y" column-type is a modified form of the "X" environment of tabularx, which I found on another Stackoverflow-thread.
The precise problem now is the following: I'd like the verbatim-expressions to be aligned with the equation-expressions or at least to be vertically centered in each cell.
As mentioned, I'm far from being an expert and I've exhausted all of my Ideas, so I'm very thankful for any form of ideas and suggestions. :)
\documentclass[c, 10pt]{beamer}
\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{placeins}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{verbatim}
\usepackage{fancyvrb}
\usepackage{nicefrac}
\usepackage{array}
\setdefaultlanguage{english}
\usetheme{JuanLesPins}
\usecolortheme{seahorse}
\newcolumntype{Y}{>{\centering\arraybackslash} X}
\begin{document}
\begin{frame}[fragile, allowframebreaks]{Symbols and Commands}
\begin{block}{\centering \large{Division}}
\begin{table}[h]
\centering
\renewcommand\baselinestretch{0.01}\selectfont
\begin{tabularx}{\textwidth}{Y Y Y}
\toprule
\multicolumn{1}{m{.3\textwidth}}{\centering Code} & \multicolumn{2}{m{.6\textwidth}}{\centering Examples}\\
\midrule
\verb|\dfrac{a}{b}| &
{\begin{equation*}
\dfrac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\dfrac{1}{k_BT}}
\end{equation*}} \\
\verb|\frac{a}{b}| &
{\begin{equation*}
\frac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\frac{1}{k_BT}}
\end{equation*}} \\
\verb|\nicefrac{a}{b}| &
{\begin{equation*}
\nicefrac{a}{b}
\end{equation*}} &
{\begin{equation*}
\mathrm{e}^{\nicefrac{1}{k_BT}}
\end{equation*}} \\
\bottomrule
\end{tabularx}
\end{table}
\end{block}
\end{frame}
\end{document}
To place unnumbered equations in a table, I would rather use inline math instead of equation environments. To get the same rendering of fractions as in equations, add \displaystyle.
Off-topic:
don't load packages multiple times
don't use fragile, allowframebreaks unless they are really necessary for the frame
floating specifier like [H] don't make sense in a document class without floating mechanism
you don't need \centering in beamer tables, they are centred by default
the syntax \large{...} is wrong, \large is a switch and does not take an argument, so it should be \large Division. Anyway it would be better to not put formatting instructions inside an macro argument, but to set the appropriate beamer template that controls the font of the block title
\documentclass[c, 10pt]{beamer}
%\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{tabularx}
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{siunitx}
%\usepackage{placeins}
\usepackage{multirow}
\usepackage{booktabs}
%\usepackage{verbatim}
%\usepackage{fancyvrb}
\usepackage{nicefrac}
\usepackage{array}
%\setdefaultlanguage{english}
\usetheme{JuanLesPins}
\usecolortheme{seahorse}
\newcolumntype{Y}{>{\centering\arraybackslash} X}
\setbeamerfont{block title}{size=\large}
\begin{document}
\begin{frame}
\frametitle{Symbols and Commands}
\begin{block}{\centering Division}
\begin{table}
% \centering
% \renewcommand\baselinestretch{0.01}\selectfont
\begin{tabularx}{\textwidth}{Y Y Y}
\toprule
Code & \multicolumn{2}{c}{Examples}\\
\midrule
\verb|\dfrac{a}{b}| &
$\displaystyle\dfrac{a}{b}$ &
$\displaystyle\mathrm{e}^{\dfrac{1}{k_BT}}$ \\\addlinespace
\verb|\frac{a}{b}| &
$\displaystyle\frac{a}{b}$ &
$\displaystyle\mathrm{e}^{\frac{1}{k_BT}}$ \\\addlinespace
\verb|\nicefrac{a}{b}| &
$\displaystyle\nicefrac{a}{b}$ &
$\displaystyle\mathrm{e}^{\nicefrac{1}{k_BT}}$ \\
\bottomrule
\end{tabularx}
\end{table}
\end{block}
\end{frame}
\end{document}

\footnote gives error in minipage environment with cta-author class

I need to use \footnote in a minipage environment, but it always gives an error
Command \itshape invalid in math mode. a\footnote{
mwe is
\documentclass{cta-author}
\begin{document}
\begin{table}
\begin{minipage}{\columnwidth}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column2 \\
a\footnote{footnote example} & b\\
\hline
\end{tabular}
\end{minipage}
\end{table}
\end{document}
Latex class file is here
You can redefine the way cta-author makes the footnote mark. Instead of $^{...}$, use \textsuperscript{...}:
\documentclass{cta-author}
\makeatletter
\def\#makefnmark{\textsuperscript{\#thefnmark}}
\makeatother
\begin{document}
\begin{table}
\begin{minipage}{\columnwidth}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column2 \\
a\footnote{footnote example} & b \\
\hline
\end{tabular}
\end{minipage}
\end{table}
% A possible work-around
\begin{table}
\begin{tabular}{|c|c|}
\hline
Column 1 & Column2 \\
a$^*$ & b \\
\hline
\end{tabular}
\medskip
\footnoterule
{\itshape\footnotesize $^*$footnote example}
\end{table}
\end{document}
And here is a visual of the work-around:

Resources