mailr9981 - in /1.3/docs/latex: fetch_docstrings.py relax.tex


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on November 26, 2009 - 12:20:
Author: bugman
Date: Thu Nov 26 12:20:26 2009
New Revision: 9981

URL: http://svn.gna.org/viewcvs/relax?rev=9981&view=rev
Log:
Massive tables in the relax manual are now being split using the longtable 
package.


Modified:
    1.3/docs/latex/fetch_docstrings.py
    1.3/docs/latex/relax.tex

Modified: 1.3/docs/latex/fetch_docstrings.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/docs/latex/fetch_docstrings.py?rev=9981&r1=9980&r2=9981&view=diff
==============================================================================
--- 1.3/docs/latex/fetch_docstrings.py (original)
+++ 1.3/docs/latex/fetch_docstrings.py Thu Nov 26 12:20:26 2009
@@ -848,6 +848,11 @@
         # Write to file.
         ################
 
+        # List of tables to be formatted using longtable.
+        longtable = {"molmol.write": [1, 3],
+                     "pymol.write": [2]
+        }
+
         # Some whitespace.
         self.file.write(" \n\n\n")
 
@@ -922,44 +927,85 @@
                 # Split the lines
                 lines = split(self.section[i], '\n')
 
-                # Start the centred table.
-                self.file.write("\\begin{table*} \n ")
-                self.file.write("\\begin{center} \n ")
-
-                # A caption.
-                self.file.write("\\caption{%s table for the %s user 
function.} \n " % (self.num_to_text(table_sub_count), user_fn))
-
-                # Start the tabular environment and add the toprule.
-                self.file.write("\\begin{tabular}{" + (int(lines[0]))*"l" + 
"} \n ")
-                self.file.write("\\toprule \n ")
-
-                # Generate the LaTeX headings.
-                elements = split(lines[1], 'SEPARATOR')
-                self.file.write(elements[0])
-                for j in range(1, len(elements)):
-                    self.file.write('&' + elements[j])
-                self.file.write(" \\\\ \n ")
-
-                # Add the midrule.
-                self.file.write("\\midrule \n ")
-
-                # Loop over the main table lines.
-                for line in lines[2:-1]:
-                    # Split columns.
-                    elements = split(line, 'SEPARATOR')
-
-                    # Write the columns.
+                # Long table.
+                if function in longtable.keys() and table_sub_count in 
longtable[function]:
+                    # Start the longtable environment centred and add the 
caption and toprule.
+                    self.file.write("\\onecolumn\n ")
+                    self.file.write("\\begin{center}\n ")
+                    self.file.write("\\begin{longtable}{" + 
(int(lines[0]))*"l" + "}\n\n ")
+                    self.file.write("\\caption{%s table for the %s user 
function.}\n\n " % (self.num_to_text(table_sub_count), user_fn))
+                    self.file.write("\\label{table%s}\n\n " % 
self.table_count)
+                    self.file.write("\\\\\n \\toprule \n ")
+
+                    # Generate the LaTeX headings.
+                    elements = split(lines[1], 'SEPARATOR')
                     self.file.write(elements[0])
                     for j in range(1, len(elements)):
                         self.file.write('&' + elements[j])
                     self.file.write(" \\\\\n ")
 
-                # Add the bottomrule and terminate the tabular and center 
environment.
-                self.file.write("\\bottomrule \n ")
-                self.file.write("\\label{table%s} \n " % self.table_count)
-                self.file.write("\\end{tabular} \n ")
-                self.file.write("\\end{center} \n ")
-                self.file.write("\\end{table*} \n ")
+                    # Add the midrule and bottomrule.
+                    self.file.write("\\midrule\n ")
+                    self.file.write("\\endhead\n\n ")
+                    self.file.write("\\bottomrule\n ")
+                    self.file.write("\\endfoot\n\n ")
+
+                    # Loop over the main table lines.
+                    for line in lines[2:-1]:
+                        # Split columns.
+                        elements = split(line, 'SEPARATOR')
+
+                        # Write the columns.
+                        self.file.write(elements[0])
+                        for j in range(1, len(elements)):
+                            self.file.write('&' + elements[j])
+                        self.file.write(" \\\\\n ")
+
+                    # Terminate.
+                    self.file.write("\\end{longtable}\n ")
+                    self.file.write("\\end{center}\n ")
+                    self.file.write("\\twocolumn\n ")
+
+                # Normal table.
+                else:
+                    # Start the centred table.
+                    self.file.write("\\begin{table*}\n ")
+                    self.file.write("\\begin{center}\n ")
+
+                    # A caption.
+                    self.file.write("\\caption{%s table for the %s user 
function.}\n " % (self.num_to_text(table_sub_count), user_fn))
+
+                    # Start the tabular environment and add the toprule.
+                    self.file.write("\\begin{tabular}{" + 
(int(lines[0]))*"l" + "}\n ")
+                    self.file.write("\\toprule\n ")
+
+                    # Generate the LaTeX headings.
+                    elements = split(lines[1], 'SEPARATOR')
+                    self.file.write(elements[0])
+                    for j in range(1, len(elements)):
+                        self.file.write('&' + elements[j])
+                    self.file.write(" \\\\\n ")
+
+                    # Add the midrule.
+                    self.file.write("\\midrule\n ")
+
+                    # Loop over the main table lines.
+                    for line in lines[2:-1]:
+                        # Split columns.
+                        elements = split(line, 'SEPARATOR')
+
+                        # Write the columns.
+                        self.file.write(elements[0])
+                        for j in range(1, len(elements)):
+                            self.file.write('&' + elements[j])
+                        self.file.write(" \\\\\n ")
+
+                    # Terminate.
+                    self.file.write("\\bottomrule\n ")
+                    self.file.write("\\label{table%s}\n " % self.table_count)
+                    self.file.write("\\end{tabular}\n ")
+                    self.file.write("\\end{center}\n ")
+                    self.file.write("\\end{table*}\n ")
 
                 # Increment the table counters.
                 self.table_count = self.table_count + 1
@@ -1007,7 +1053,7 @@
                     else:
                         # Get the description.
                         elements = split(lines[j], ':')
-                        
+
                         # End of list.
                         if len(elements) != 2:
                             continue

Modified: 1.3/docs/latex/relax.tex
URL: 
http://svn.gna.org/viewcvs/relax/1.3/docs/latex/relax.tex?rev=9981&r1=9980&r2=9981&view=diff
==============================================================================
--- 1.3/docs/latex/relax.tex (original)
+++ 1.3/docs/latex/relax.tex Thu Nov 26 12:20:26 2009
@@ -11,6 +11,7 @@
 
 % Good looking tables.
 \usepackage{booktabs}
+\usepackage{longtable}
 
 % Obliterate those painful LaTeX margins!
 \usepackage{vmargin}




Related Messages


Powered by MHonArc, Updated Thu Nov 26 12:40:02 2009