나는 가지고있다
\title{A64L(3)}
somethings
\textbf{a64l}()
\title{MALLOC(3)}
somethings
\textbf{malloc}()
제 생각에는
\title{\hypertarget{a64l}{A64L(3)}}
somethings
\textbf{\hyperlink{a64l}{a64l}}()
\title{\hypertarget{malloc}{MALLOC(3)}}
somethings
\textbf{\hyperlink{malloc}{malloc}}()
또는
\title{\hypertarget{a64l}{A64L}(3)}
somethings
\textbf{\hyperlink{a64l}{a64l}}()
\title{\hypertarget{malloc}{MALLOC}(3)}
somethings
\textbf{\hyperlink{malloc}{malloc}}()
샘플 파일입니다. A64L
및 MALLOC
대신에 패턴을 따르는 것 외에는 무엇이든 있을 수 있습니다 (예 \title{new_word}
: ).
설명된 기능을 얻으려면 이 작업을 수행해야 했습니다.https://tex.stackexchange.com/questions/407884/how-to-make-a-title-as-link-target
나는 선호한다 vim
, sed
, awk
.
귀하의 답변은 다음에도 적용되어야 합니다.
\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{A64L(3)}
\author{}
\date{}
\begin{document}
\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{);}
~
\textbf{char *l64a(long}\emph{value}\textbf{);}
~
Feature Test Macro Requirements for glibc (see
\textbf{feature\_test\_macros}(7)): \\
~
\textbf{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{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{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{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}
편집하다
답변 중 어느 것도 청구서에 정확히 들어맞지 않아서 질문을 변경했습니다. 이 변경으로 인해 동일한 결과가 나왔지만 방식이 달랐습니다.
주로 같은 단어의 제목이 있는 모든 굵은 텍스트를 연결하고 싶습니다. 예를 들어 및 을(를) 사용하여 링크를
만들고 싶습니다 .\textbf{malloc}
\title{MALLOC(3)}
\textbf{a64l}
\title{A64L(3)}
index
이제 제목 단어가 포함된 파일을 만듭니다.
문서색인
MALLOC(3)
A64L(3)
또는
MALLOC
A64L
또는
malloc
a64l
index
파일을 사용하여 기본 파일을 수정하는 것이 이전 방법보다 쉬운 것 같습니다 .
의사코드
while read word
do
l_word=${word,,}
echo $l_word
sed -e 's/\\title{$word\(3\)}/\\title{\\hypertarget{$word}{$word\(3\)}}/' -e 's/\\textbf{$l_word}/\\textbf{\\hyperlink{$word}{$l_word}}/' inputfile > output.tex
done < index
[이 코드에는 감지할 수 없는 오류가 있습니다.]
답변1
아래 내용이 작동하는 것 같습니다. 확인하고 업데이트하세요. 일부 데이터로 테스트 한 후 나에게 효과적이었습니다.
sed "/title/s/{.*/{\hypertarget{&&/g" filename | sed -e "/title/s/A64/a64/1" -e "/title/s/MALLOC/malloc/1" | sed "/textbf/s/{.*}/{\hyperlink&&/g"| sed "s/{\{2\}/{/1" | sed "s/(3)//1"
답변2
#!/bin/bash
while read word
do
l_word=${word,,}
sed -e s/\\\\title{$word\(3\)}/\\\\title{\\\\hypertarget{$word}{$word\(3\)}}/g -e s/\\\\textbf{$l_word}/\\\\textbf{\\\\hyperlink{$word}{$l_word}}/g inputfile > output.tex
done < index
이것이 가능하기는 하지만 제가 만들 수 없는 정규식에 대한 색인 파일 없이도 수행할 수 있습니다.