0

solution

I used the above solution described in How to create pdf from Linux man pages so that style is presereved?. I have two files bcopy.3.gz.tex

\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={BCOPY(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}}

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

\title{BCOPY(3)}
\author{}
\date{}

\begin{document}
\maketitle

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

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

bcopy - copy byte sequence

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

\begin{verbatim}
#include <strings.h>
 
void bcopy(const void *src, void *dest, size_t n);
\end{verbatim}

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

The \textbf{bcopy}() function copies \emph{n} bytes from \emph{src} to
\emph{dest}. The result is correct, even when both areas overlap.

\hyperdef{}{RETURNux5fVALUE}{\section{\hyperref[RETURNux5fVALUE]{RETURN
VALUE}}\label{RETURNux5fVALUE}}

None.

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

4.3BSD. This function is deprecated (marked as LEGACY in POSIX.1-2001):
use \textbf{memcpy}(3) or \textbf{memmove}(3) in new programs. Note that
the first two arguments are interchanged for \textbf{memcpy}(3) and
\textbf{memmove}(3). POSIX.1-2008 removes the specification of
\textbf{bcopy}().

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

\textbf{memccpy}(3), \textbf{memcpy}(3), \textbf{memmove}(3),
\textbf{strcpy}(3), \textbf{strncpy}(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
2009-03-15 & Linux
\\\addlinespace
\bottomrule
\end{longtable}

\end{document}

and bcmp.3.gz.tex.

\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={BCMP(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}}

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

\title{BCMP(3)}
\author{}
\date{}

\begin{document}
\maketitle

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

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

bcmp - compare byte sequences

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

\begin{verbatim}
#include <strings.h>
 
int bcmp(const void *s1, const void *s2, size_t n);
\end{verbatim}

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

The \textbf{bcmp}() function compares the two byte sequences \emph{s1}
and \emph{s2} of length \emph{n} each. If they are equal, and in
particular if \emph{n} is zero, \textbf{bcmp}() returns 0. Otherwise it
returns a nonzero result.

\hyperdef{}{RETURNux5fVALUE}{\section{\hyperref[RETURNux5fVALUE]{RETURN
VALUE}}\label{RETURNux5fVALUE}}

The \textbf{bcmp}() function returns 0 if the byte sequences are equal,
otherwise a nonzero result is returned.

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

4.3BSD. This function is deprecated (marked as LEGACY in POSIX.1-2001):
use \textbf{memcmp}(3) in new programs. POSIX.1-2008 removes the
specification of \textbf{bcmp}().

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

\textbf{memcmp}(3), \textbf{strcasecmp}(3), \textbf{strcmp}(3),
\textbf{strcoll}(3), \textbf{strncasecmp}(3), \textbf{strncmp}(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
2008-08-06 & Linux
\\\addlinespace
\bottomrule
\end{longtable}

\end{document}

I have done followings -

sed -i '/begin{document}/d' bcmp.3.gz.tex
sed -i '/end{document}/d' bcopy.3.gz.tex
sed -i 1,61d bcmp.3.gz.tex
cat bcopy.3.gz.tex bcmp.3.gz.tex > new.tex
pdflatex new.tex
evince new.pdf  

Result is -
enter image description here enter image description here Although the BCMP is declared as title it is shifted to left. I want to put it in middle to keep similar pattern of all title.

This may be done by book or report class. But @ShreevatsaR sulution's return article by default.

alhelal
  • 2,451

0 Answers0