TransWikia.com

Dotfill like in the Table of Contents

TeX - LaTeX Asked by Savard Oleggson on December 28, 2020

I would like to make a custom table with symmetrical dot leader like in the table of contents or on the picture

What i want

But when I use dotfill:

documentclass[pdftex,12pt,a4paper,oneside]{article}
usepackage{tabularx}
usepackage[T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[english,russian]{babel}

begin{document}

begin{tabular}{lll}
Item   & multicolumn{2}{c}{Цена, р.} 
hline
& 2018 г. & 2019 г.
Е д а:
Мясоdotfill     & 2500 (10 кг. по 250/кг.) & 2790 (10 кг. свинины)
Сосискиdotfill  & 2500 (5 кг.)             & 450 (4,5 кг.)
Огурцыdotfill   & 500                      & 80 (3 кг.)
Помидорыdotfill & 500                      & 60 (2 кг.)
Зеленьdotfill   && 220
Лукdotfill      & 60 (4-5 шт.)             & 50
Специиdotfill   & 500                      & 1050
Кетчупdotfill   & 240 (3 по 0,5 л.)        & 120 (3 упаковки)
Уксусdotfill    & 80
Хлебdotfill     &                          & 320 (7 буханок)
hline
Всего            &6880                      & 5140
hline
end{tabular}

end{document}

I get the following:

What I get

How can I get the desirable symmetrical dotfill in a custom table?

One Answer

Edit

Now I see: You need leaders, like here:

documentclass[12pt,a4paper]{article}
% usepackage{tabularx}
usepackage{booktabs,microtype}
usepackage[T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[english,russian]{babel}

makeatletter
renewcommand dotfill {leavevmode leaders hb@xt@ .44em{hss .hss }hfill kern z@}
makeatother

begin{document}

begin{tabular}{p{3cm}ll}
Item   & multicolumn{2}{c}{Цена, р.} 
toprule
& 2018 г. & 2019 г.
Е д а:
Мясоdotfill     & 2500 (10 кг. по 250/кг.) & 2790 (10 кг. свинины)
Сосискиdotfill  & 2500 (5 кг.)             & 450 (4,5 кг.)
Огурцыdotfill   & 500                      & 80 (3 кг.)
Помидорыdotfill & 500                      & 60 (2 кг.)
Зеленьdotfill   && 220
Лукdotfill      & 60 (4-5 шт.)             & 50
Специиdotfill   & 500                      & 1050
Кетчупdotfill   & 240 (3 по 0,5 л.)        & 120 (3 упаковки)
Уксусdotfill    & 80
Хлебdotfill     &                          & 320 (7 буханок)
midrule
Всего            &6880                      & 5140
bottomrule
end{tabular}

end{document}

table with leader and dotfill

Correct answer by phil-elkabat on December 28, 2020

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