-1

Related questions:

I have a sample file looks like -

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{titling}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e}
\usepackage{hyperref}
\hypersetup{breaklinks=true,
bookmarks=true,
pdfauthor={},
pdftitle={A64L(3)},
colorlinks=true,
citecolor=blue,
urlcolor=blue,
linkcolor=magenta,
pdfborder={0 0 0}}
\title{\hypertarget{a64l}{A64L(3)}}
\begin{document}
\maketitle
something here
\hyperdef{}{NAME}{\section{\hyperref[NAME]{NAME}}\label{NAME}}
something here
\hyperdef{}{SYNOPSIS}{\section{\hyperref[SYNOPSIS]{SYNOPSIS}}\label{SYNOPSIS}}
something here
something here
\title{\hypertarget{malloc}{MALLOC(3)}}
something here
\hyperdef{}{NAME}{\section{\hyperref[NAME]{NAME}}\label{NAME}}
something here
\hyperdef{}{SYNOPSIS}{\section{\hyperref[SYNOPSIS]{SYNOPSIS}}\label{SYNOPSIS}}
something here
something here
something here
\title{\hypertarget{strcmp}{STRCMP(3)}}
something here
\hyperdef{}{NAME}{\section{\hyperref[NAME]{NAME}}\label{NAME}}
something here
\hyperdef{}{SYNOPSIS}{\section{\hyperref[SYNOPSIS]{SYNOPSIS}}\label{SYNOPSIS}}
\end{document}

I want to make a TOC using the title only(excluding the section's name NAME, SYNOPSIS because these are in under every title.) that looks like -

a64l--------------------------3  
malloc -----------------------10  
strcmp -----------------------15 

And all page have the title as headnotes. I have also a list file of the titles.

The looking of title is -

enter image description here

If you have any good recommendation that needs section/part, then you can say.

You can use following file to view the output -

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
    \usepackage{xltxtra,xunicode}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  \newcommand{\euro}{€}
\fi
% use microtype if available
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
\usepackage{longtable,booktabs}
\ifxetex
  \usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
              xetex]{hyperref}
\else
  \usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true,
            bookmarks=true,
            pdfauthor={},
            pdftitle={A64L(3)},
            colorlinks=true,
            citecolor=blue,
            urlcolor=blue,
            linkcolor=magenta,
            pdfborder={0 0 0}}
\urlstyle{same}  % don't use monospace font for urls
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\setcounter{secnumdepth}{0}
\usepackage{pagecolor}

% Set background colour (of the page)
\definecolor{weirdbgcolor}{HTML}{FCF4F0}
\pagecolor{weirdbgcolor}

% Make bold text appear in a particular colour
\definecolor{boldcolor}{HTML}{6E0002}
\let\realtextbf=\textbf
\renewcommand{\textbf}[1]{\textcolor{boldcolor}{\realtextbf{#1}}}

% Use underlines instead of emphasis (ugh)
\renewcommand{\emph}[1]{\underline{#1}}
\hypersetup{breaklinks=false}

% % Use fixed-width font by default
% \renewcommand*\familydefault{\ttdefault}

\title{\hypertarget{A64L}{A64L(3)}}
\author{}
\date{}

\begin{document}
\tableofcontents
\maketitle

\begin{longtable}[c]{@{}lll@{}}
\toprule\addlinespace
A64L(3) & Linux Programmer's Manual & A64L(3)
\\\addlinespace
\bottomrule
\end{longtable}

\hyperdef{}{NAME}{\section{\hyperref[NAME]{NAME}}\label{NAME}}

a64l, l64a - convert between long and base-64

\hyperdef{}{SYNOPSIS}{\section{\hyperref[SYNOPSIS]{SYNOPSIS}}\label{SYNOPSIS}}

\textbf{\#include \textless{}stdlib.h\textgreater{}}

~

\textbf{long a64l(char *}\emph{str64}\textbf{);}
\addcontentsline{toc}{section}{new section}
~

\textbf{char *l64a(long}\emph{value}\textbf{);}

~

Feature Test Macro Requirements for glibc (see
\textbf{feature\_test\_macros}(7)): \\

~

\textbf{\hyperlink{A64L}{a64l}}(), \textbf{l64a}():

~

\_SVID\_SOURCE \textbar{}\textbar{} \_XOPEN\_SOURCE~\textgreater{}=~500
\textbar{}\textbar{} \_XOPEN\_SOURCE~\&\&~\_XOPEN\_SOURCE\_EXTENDED

\hyperdef{}{DESCRIPTION}{\section{\hyperref[DESCRIPTION]{DESCRIPTION}}\label{DESCRIPTION}}

These functions provide a conversion between 32-bit long integers and
little-endian base-64 ASCII strings (of length zero to six). If the
string used as argument for \textbf{\hyperlink{A64L}{a64l}}() has length greater than six,
only the first six bytes are used. If the type \emph{long} has more than
32 bits, then \textbf{l64a}() uses only the low order 32 bits of
\emph{value}, and \textbf{\hyperlink{A64L}{a64l}}() sign-extends its 32-bit result.

The 64 digits in the base-64 system are:

\begin{verbatim}

'.' represents a 0
'/' represents a 1
0-9 represent  2-11
A-Z represent 12-37
a-z represent 38-63
\end{verbatim}

So 123 = 59*64\^{}0 + 1*64\^{}1 = ``v/''.

\hyperdef{}{ATTRIBUTES}{\section{\hyperref[ATTRIBUTES]{ATTRIBUTES}}\label{ATTRIBUTES}}

\hyperdef{}{Multithreadingux5fux28seeux5fpthreadsux287ux29ux29}{\subsection{\hyperref[Multithreadingux5fux28seeux5fpthreadsux287ux29ux29]{Multithreading
(see
pthreads(7))}}\label{Multithreadingux5fux28seeux5fpthreadsux287ux29ux29}}

The \textbf{l64a}() function is not thread-safe.

The \textbf{\hyperlink{A64L}{a64l}}() function is thread-safe.

\hyperdef{}{CONFORMINGux5fTO}{\section{\hyperref[CONFORMINGux5fTO]{CONFORMING
TO}}\label{CONFORMINGux5fTO}}

POSIX.1-2001.

\hyperdef{}{NOTES}{\section{\hyperref[NOTES]{NOTES}}\label{NOTES}}

The value returned by \textbf{l64a}() may be a pointer to a static
buffer, possibly overwritten by later calls.

The behavior of \textbf{l64a}() is undefined when \emph{value} is
negative. If \emph{value} is zero, it returns an empty string.

These functions are broken in glibc before 2.2.5 (puts most significant
digit first).

This is not the encoding used by \textbf{uuencode}(1).

\hyperdef{}{SEEux5fALSO}{\section{\hyperref[SEEux5fALSO]{SEE
ALSO}}\label{SEEux5fALSO}}

\textbf{uuencode}(1), \textbf{strtoul}(3)

\hyperdef{}{COLOPHON}{\section{\hyperref[COLOPHON]{COLOPHON}}\label{COLOPHON}}

This page is part of release 3.54 of the Linux \emph{man-pages} project.
A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.

\begin{longtable}[c]{@{}ll@{}}
\toprule\addlinespace
2013-06-21 &
\\\addlinespace
\bottomrule
\end{longtable}
\end{document}

This question is extension of How to create pdf from Linux man pages so that style is presereved?

  • Are you aware of the command \addcontentsline? If not, it might be worthwhile playing around with this command. – marmot Dec 31 '17 at 2:35
  • @marmot I don't use it yet. – alhelal Dec 31 '17 at 2:47
  • The title of your question is extremely misleading. You want to omit the name of the sections, not the sections itself – user31729 Dec 31 '17 at 11:27
  • @ChristianHupfer You are right. I edited the title. – alhelal Dec 31 '17 at 12:17
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Jul 23 '18 at 17:31
-1
sed -i -e 's/\\section{/\\section\*{/g' -e '/\\title{\\hypertarget\({[^}]*}\).*/&\n\\addcontentsline{toc}{section}\1/' filename  
sed -i -e '/\\begin{document}/a\\\tableofcontents' filename

.
credit steeldriver

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.