1

I need to set the caption of a table to be above left as shown below, not like this. case Target

"the answer for this question didn't work".

\documentclass[review]{elsarticle}

 \usepackage{caption}

 \usepackage{tabularx}
 \usepackage{rotating}
 \usepackage{array}
 \usepackage{booktabs}
 \usepackage{ltablex,booktabs}
 \usepackage{lineno,hyperref}
 \begin{table*}[hbt]

 \setlength{\tabcolsep}{1.5pc}

 \newlength{\digitwidth} \settowidth{\digitwidth}{\rm 0}
 \catcode`?=\active \def?{\kern\digitwidth}
 \caption{Biologically treated effluents (mg/l)}
 \label{tab:effluents}
 \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}rrrr}
 \hline
              & \multicolumn{2}{l}{Pilot plant} 
              & \multicolumn{2}{l}{Full scale plant} \\
 \cline{2-3} \cline{4-5}
              & \multicolumn{1}{r}{Influent} 
              & \multicolumn{1}{r}{Effluent} 
              & \multicolumn{1}{r}{Influent} 
              & \multicolumn{1}{r}{Effluent}         \\
 \hline
 Total cyanide    & $ 6.5$ & $0.35$ & $  2.0$ & $  0.30$ \\
 Method-C cyanide & $ 4.1$ & $0.05$ &         & $  0.02$ \\
 Thiocyanide      & $60.0$ & $1.0?$ & $ 50.0$ & $ <0.10$ \\
 Ammonia          & $ 6.0$ & $0.50$ &         & $  0.10$ \\
 Copper           & $ 1.0$ & $0.04$ & $  1.0$ & $  0.05$ \\
 Suspended solids &        &        &         & $<10.0?$ \\
 \hline
 \multicolumn{5}{@{}p{120mm}}{Reprinted from: G.M. Ritcey,
                         Tailings Management,
                         Elsevier, Amsterdam, 1989, p. 635.}
 \end{tabular*}
 \end{table*}
  \end{document}
  • 1
    What do you mean by 'didn't work'? Show us what you tried in the form of a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Troy Aug 17 '17 at 16:21
  • The two answers worked for me. Can you show how it does not work for you? – moewe Aug 17 '17 at 18:29
  • How could i show this , "it gives the same result" – Bakr Hesham Aug 17 '17 at 18:31
  • The problem is that in your first image there is no caption at all. I get the output as shown in the answers. In your now deleted post we can clearly see that the caption is below the table which is not the case with the answers. – moewe Aug 17 '17 at 18:38
  • My deleted answer is the result of copying your code. – Bakr Hesham Aug 17 '17 at 19:09
1

The key here is changing the displayed caption to Biologically treated effluents (mg/l)\hfill\mbox{}, adding the \hfill.

\documentclass[review]{elsarticle}
\usepackage[margin=1cm]{geometry}
\usepackage{caption}

\usepackage{tabularx}
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{ltablex,booktabs}
\usepackage{lineno,hyperref}
\begin{document}
\listoftables
\begin{table*}[hbt]

 \setlength{\tabcolsep}{1.5pc}

 \newlength{\digitwidth} \settowidth{\digitwidth}{\rm 0}
 \catcode`?=\active \def?{\kern\digitwidth}
 \caption[Biologically treated effluents (mg/l)]{%
  Biologically treated effluents (mg/l)\hfill\mbox{}}
 \label{tab:effluents}
 \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}rrrr}
 \hline
              & \multicolumn{2}{l}{Pilot plant} 
              & \multicolumn{2}{l}{Full scale plant} \\
 \cline{2-3} \cline{4-5}
              & \multicolumn{1}{r}{Influent} 
              & \multicolumn{1}{r}{Effluent} 
              & \multicolumn{1}{r}{Influent} 
              & \multicolumn{1}{r}{Effluent}         \\
 \hline
 Total cyanide    & $ 6.5$ & $0.35$ & $  2.0$ & $  0.30$ \\
 Method-C cyanide & $ 4.1$ & $0.05$ &         & $  0.02$ \\
 Thiocyanide      & $60.0$ & $1.0?$ & $ 50.0$ & $ <0.10$ \\
 Ammonia          & $ 6.0$ & $0.50$ &         & $  0.10$ \\
 Copper           & $ 1.0$ & $0.04$ & $  1.0$ & $  0.05$ \\
 Suspended solids &        &        &         & $<10.0?$ \\
 \hline
 \multicolumn{5}{@{}p{120mm}}{Reprinted from: G.M. Ritcey,
                         Tailings Management,
                         Elsevier, Amsterdam, 1989, p. 635.}
 \end{tabular*}
 \end{table*}
\end{document}

enter image description here

1

The answer works for me. I took the opportunity to replace \hlines and \clines with rules from booktabs since you load it, and to type the reference at the bottom of table in \footnotesize. I think the two \multicolumns in the first row look nicer if centred. Last: I used tabularx rather than tabular*:

\documentclass[review]{elsarticle}

\usepackage{caption}

\usepackage{tabularx}
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{ltablex,booktabs}
\usepackage{lineno,hyperref}

\begin{document}

\begin{table*}[!hbt]
\setlength{\tabcolsep}{1.5pc}
\captionsetup{singlelinecheck = false}
\newlength{\digitwidth} \settowidth{\digitwidth}{\rm 0}
\catcode`?=\active \def?{\kern\digitwidth}
\caption{Biologically treated effluents (mg/l)}
\label{tab:effluents}
\begin{tabularx}{\textwidth}{@{}lrrrr}
\toprule
             & \multicolumn{2}{c}{Pilot plant}
             & \multicolumn{2}{c}{Full scale plant} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5}
             & \multicolumn{1}{r}{Influent}
             & \multicolumn{1}{r}{Effluent}
             & \multicolumn{1}{r}{Influent}
             & \multicolumn{1}{r}{Effluent} \\
\hline
Total cyanide & $ 6.5$ & $0.35$ & $ 2.0$ & $ 0.30$ \\
Method-C cyanide & $ 4.1$ & $0.05$ & & $ 0.02$ \\
Thiocyanide & $60.0$ & $1.0?$ & $ 50.0$ & $ <0.10$ \\
Ammonia & $ 6.0$ & $0.50$ & & $ 0.10$ \\
Copper & $ 1.0$ & $0.04$ & $ 1.0$ & $ 0.05$ \\
Suspended solids & & & & $<10.0?$ \\
\bottomrule
\multicolumn{5}{@{}p{120mm}}{\footnotesize Reprinted from: G.M. Ritcey,
                        Tailings Management,
                         Elsevier, Amsterdam, 1989, p. 635.}
\end{tabularx}
\end{table*}

\end{document} 

enter image description here

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.