6

Below is the latex example i am working on, it should generate two tables. One table with two columns, the other table is just one column. And i have a software program it makes any word in the table looks like #blabla replaced as \textcolor{green}{$#blabla$}

But i got errors, what is the problem?

asd

It should produce a file looks like this enter image description here

Below is the original code, I am not sure if the formatting has any influence for the result, so I just copied it here directly, and posted the picture above.

\documentclass[a4paper,leqno,twoside]{article}
\usepackage[utf8]{inputenc}

\title{dd}

\usepackage{amsmath}
\usepackage{color}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{supertabular}

\begin{document}

\maketitle

\section{Introduction}
it is a introduction

\subsection{it is a subsection}

\begin{longtabu} to \textwidth {|>{\footnotesize}X[1 , p]| X[3 , l ]| } \hline
\endfirsthead    
\multicolumn{2}{c}    
\endhead    
\endfoot    \hline    
\endlastfoot      
sdf \newline  \newline  & >>Text \newline asdfl \textcolor{green}{$\#lksdjf$} asldkj.\newline     
\end{longtabu}    
\begin{longtabu} to \textwidth {>{\normalsize}X[p ] }        
\endfirsthead    \multicolumn{1}{c}    
\endhead    
\endfoot    
\endlastfoot    >>Text \newline >>Text    
\end{longtabu}
\end{document}
3

Would this be what you were after!. After some studies, errors were found

 \multicolumn{2}{c}{}  % 2 such cases: missing the last {}
 $>>$                  % 3 such cases: need math environment

enter image description here

Code

\documentclass[a4paper,leqno,twoside]{article}
\usepackage[utf8]{inputenc}

\title{dd}

\usepackage{amsmath} 
\usepackage{color} 
\usepackage{tabu} 
\usepackage{longtable} \usepackage{supertabular}

\begin{document}

\maketitle

\section{Introduction} it is a introduction

\subsection{it is a subsection}

\begin{longtabu} to \textwidth {|>{\footnotesize}X[1 , p]| X[3 , l ]| } \hline
\endfirsthead    
\multicolumn{2}{c}{}    
\endhead    
\endfoot    \hline    
\endlastfoot      
sdf \newline  \newline  & $>>$Text \newline asdfl \textcolor{green}{$\#lksdjf$} asldkj.\newline     
\end{longtabu}    
\begin{longtabu} to \textwidth {>{\normalsize}X[p ] }        
\endfirsthead    
\multicolumn{1}{c}{}  
\endhead    
\endfoot    
\endlastfoot    
$>>$Text \newline $>>$Text  
\end{longtabu}
\end{document}
  • THANKS!! missing the last {}, that is the problem. Another question, if i use \multicolumn{2}{c}%, what is the percentage % used for? I use % before, then i got the error, and remove it still with error. Sorry the code i wrote many days ago, i forget why i use % at the last... – postit Aug 30 '14 at 13:26
  • % is for remarks. LaTeX will ignore every thing after % until the end of that line. – Jesse Aug 30 '14 at 13:37
  • yes,comment out every thing, i just forget why i use it there, but anyway, it is not a problem now. Have a nice weekend! – postit Aug 30 '14 at 13:52

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.