TransWikia.com

How to set different fonts for tables and algorithms

TeX - LaTeX Asked by Tripti Agrawal on January 1, 2021

I am writing my thesis. The ‘documentclass’ is

documentclass[12pt,openright,twoside]{ducs}

I have a large algorithm that can be adjusted to one page by using ‘small’ font size. For this I used

begin{algorithm}[H]small

However, ‘small’ is not working. The same holds for large tables. I need help to override the existing font size which is 12 in my algorithms, tables, and colorbox as well.

One Answer

To long for the comment.

Command small had to be before table or your algorithm code. For example:

documentclass[12pt]{article}
usepackage[]{algorithm2e}
usepackage{lipsum}

begin{document}
lipsum[11]
begin{table}[ht]
footnotesize   % that change of the font size is better visible
centering
begin{tabular}{rl}
hline
 1  &   some text   
11  &   some text   
hline
end{tabular}
end{table}

lipsum[12]

begin{algorithm}[ht]
footnotesize   % that change of the font size iz better visible
 KwData{this text}
 KwResult{how to write algorithm with LaTeX2e }
 initialization;
 While{not at end of this document}{
  read current;
  eIf{understand}{
   go to next section;
   current section becomes this one;
   }{
   go back to the beginning of current section;
  }
 }
 caption{How to write algorithms}
end{algorithm}

lipsum[13]

end{document}

enter image description here

Note: In MWE is selected footnotesize font size that their size changes is better visible.

Correct answer by Zarko on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP