5

How can I align the \rightarrow symbols in the cells below?

\begin{table*}[t]
\begin{adjustbox}{center}
\begin{tabular}{L{3cm}C{2.6cm}C{2.6cm}C{2.6cm}}
\toprule
 Norwegian $\rightarrow$ Swedish & ? & ? & ?  \\
 Swedish $\rightarrow$ Norwegian & ? & ? & ? \\
...
  • 1
    Welcome to TeX.SE! Couldn't you just add extra columns for that? You will almost certainly get a nice answer if you provide an MWE. – user121799 May 18 '18 at 3:56
4

with simple basic tabular environment with l and c columns' specifiers:

edite: reduce space around \rightarrow and added example withr column specifier for the first column

\documentclass{article}
\usepackage{booktabs}

\begin{document}
    \begin{table}[htb]
\centering
\begin{tabular}{l@{\,}c@{\,}l} % <---
    \toprule
 Amazon     & $\rightarrow$ & Twitter   \\
 Twitter    & $\rightarrow$ & Amazon    \\
 Norwegian  & $\rightarrow$ & Swedish   \\
 Swedish    & $\rightarrow$ & Norwegian \\
    \bottomrule
\end{tabular}

\medskip
\begin{tabular}{r@{\,}c@{\,}l} % <---
    \toprule
 Amazon     & $\rightarrow$ & Twitter   \\
 Twitter    & $\rightarrow$ & Amazon    \\
 Norwegian  & $\rightarrow$ & Swedish   \\
 Swedish    & $\rightarrow$ & Norwegian \\
    \bottomrule
\end{tabular}
    \end{table}
\end{document}

enter image description here

|improve this answer|||||
  • @Sebastiano, good morning! thank you very much! – Zarko May 18 '18 at 6:27
  • Nice solution. However, how do you solve the issue I'm also having with the arrows having too much white space around them? – pir May 18 '18 at 6:29
  • @pir You could use {tabular}{rcl} and then have a look at this answer – gvgramazio May 18 '18 at 8:36
  • @pir, see edited answer. – Zarko May 18 '18 at 8:41
1

I've been facing the same issue. Here's a solution using extra columns as also suggested by @marmot in a comment. However, I'm not completely satisfied with this solution as there's quite a bit of space between the text and arrows. If anyone can find a way to flexibly adjust the amount of space between the text and the arrows, then that would be awesome. I can't just reduce the column size as the text then becomes multi-line.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{booktabs}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{L}[1]{>{\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{multicol}

\begin{document}

\begin{table*}[t]
\centering
\small
\label{tab:da_balanced}
\begin{adjustbox}{center}
\begin{tabular}{L{1.5cm}L{0.5cm}L{1.5cm}}
\toprule
 Amazon & $\rightarrow$ & Twitter \\
 Twitter & $\rightarrow$ & Amazon \\
 Norwegian & $\rightarrow$ & Swedish \\
 Swedish & $\rightarrow$ & Norwegian \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table*}

\end{document}
|improve this answer|||||
1

One could also use the \rightarrow command in the column definition of the table to avoid repeating this command in every line:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{table}[htb]
  \centering
  \begin{tabular}{l@{\,$\rightarrow$\,}l}
    \toprule
       Norwegian  & Swedish   \\
       Swedish    & Norwegian \\
     \bottomrule
  \end{tabular}
\end{table}
\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.