GeneralEquation Numbering and Table Font Size

LaTeX specific issues not fitting into one of the other forums of this category.
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Equation Numbering and Table Font Size

Post by Joao »

Hi folks

My University doesn't offer a template for thesis in laTeX, so I'm writing code in LaTeX to create my own.
I've used a template by another guy, based on book.cls, and modified it according to my University rules. But I run into two problems:

1. The rules specify that the equations should be centered and the equation number will come immediately at the end of equation (so, would be centered with the equation). I'm using the amsmath package, which only offers the options of putting the equation number on the right or on the left of the page, is there any hack I can make at my class to make my template according to the rules, or another package similar to amsmath that has that option?

2. The rules say that text has to be 10pt, but tables should be 9pt. I've tried to hack the class file to accomplish this, but wasn't successful (it worked fine for the font of the chapters and sections), can you provide me another solution which is not place in each table \footnotesize after the begin tag, which would be necessary to place in each table?

Second problem is not important, but the first one is.

Thanks for the help :-)
Last edited by Joao on Sun Jun 19, 2011 6:51 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Equation Numbering and Table Font Size

Post by Stefan Kottwitz »

These rules are strange. Equations are numbered for referencing and look-up. Let's say, I look for equation 5.4, I just scan the border for the number. If the equation tags are scattered all over the text, from the center to the right, the numbers are hard to find. Numbers aren't just for decoration.

Since you write a thesis, you work with many scientific books. Can you tell me, any book of those uses such a style? With this in mind, you could speak about improvement of the rules.

Stefan
LaTeX.org admin
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Re: Equation Numbering and Table Font Size

Post by Joao »

Hi.

Yes I know, and I totally agree with you, it's stupid because the equation number is "mixed" with the equation itself. I can only found the explanation for this as the people who approved the rule are used to Word, you know Word is crap regarding equations, I see my friends having to insert an invisible table to get the equation number aligned left, so I guess they approved that rule to make life easier for Word users.

But unfortunately that is the rule approved by the Rector, and I have to follow it, or my thesis will be rejected. :cry:

Edit: the books I know all use the equation number aligned to the right of the page (to make them more visible). I guess nobody uses that rule (except this University)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Equation Numbering and Table Font Size

Post by Stefan Kottwitz »

Hi Joao,

fortunately, LaTeX makes it easy to follow also such rules by modifying the document style in a consistent way. Of course I will help you, so I will return to that topic later today when I've got some time.

Stefan
LaTeX.org admin
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Equation Numbering and Table Font Size

Post by Joao »

Stefan_K wrote:Hi Joao,

fortunately, LaTeX makes it easy to follow also such rules by modifying the document style in a consistent way. Of course I will help you, so I will return to that topic later today when I've got some time.

Stefan
Thank you Stefan 8-)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Equation Numbering and Table Font Size

Post by Stefan Kottwitz »

Hi Joao,

here's the solution for smaller font size in all table environments, in a compilable example:

Code: Select all

\documentclass[10pt]{book}
\makeatletter
\renewenvironment{table}{%
  \renewcommand* {\@floatboxreset}{%
    \reset@font\@setminipage}
  \small\@float{table}}
  {\end@float}
\makeatother
\begin{document}
Text in 10pt

\begin{table}[!htbp]
\begin{tabular}{l}
Text in 9pt
\end{tabular}
\end{table}

Text in 10pt
\end{document}
  • I redefined the table environment for inserting our font command
  • I chose \small which means 9pt in a document with 10pt base font size
  • I redefined \@floatboxreset because originally it contains \normalsize, which would override our \small
  • I used \makeatletter ... \makeatother around the redefinition because macros with @ in their name were used.
For reference, here are the original macros:

Code: Select all

% From book.cls:
\newenvironment{table}
               {\@float{table}}
               {\end@float}
% From ltfloat.ltx:
\def \@floatboxreset {%
        \reset@font
        \normalsize
        \@setminipage
}
Stefan
LaTeX.org admin
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Equation Numbering and Table Font Size

Post by Joao »

Thanks for the code.

It does work on another document, but I was unable to get it working in my template.
Placed the code in my formatanddef.tex file (which is where I place this type of code), no change.
Placed the code without the "\make..." tags in the end of my book.cls, no change.
Placed the code right before a table, no change.

But it works if I write:

Code: Select all

\begin{table}[h]\small
\caption{Current consumption of the IRIS mote components}
	\centering
		\begin{tabular}{|c|c|}
		\hline
			\textbf{Component} & \textbf{Current drain} \cr
			\hline
			Controller (full speed) & 8mA \cr
			\hline
			Controller (sleep mode) & 8$\mu$A \cr
			\hline
			Radio (receiving) & 16mA \cr
			\hline
			Radio (transmitting) & 17mA@3dBm \cr
			\hline
			Radio (sleep mode) & <1$\mu$A \cr
			\hline
		\end{tabular}
	\label{cap01:tabela-consumo}
\end{table}
I run out of ideas on why this isn't working, do you have any idea on what might be wrong?

Thanks for your time
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Equation Numbering and Table Font Size

Post by Stefan Kottwitz »

So post your version book.cls or your template, respectively, as attachment here. It should be easy to customize it to work with your code, if I know your code.

Stefan
LaTeX.org admin
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Re: Equation Numbering and Table Font Size

Post by Joao »

Thank you, I've zipped all the files, Thesis.tex is the main file, than you have formatacaoUBI.tex which defines the formats, and the class file. ;)
Attachments
template-latex.zip
My template files
(96.09 KiB) Downloaded 858 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Equation Numbering and Table Font Size

Post by Stefan Kottwitz »

I would return to your question regarding the tags. However, two topics would be mixed in one thread. I suggest you create a new question in the math sub-forum, copying that part of the question there.

Stefan
LaTeX.org admin
Post Reply