2

I have a list

\begin{enumerate}
\item This is the first post
\item This is the second post
\end{enumerated}

And I want to add hyperlinks to the numberings within a box.

The simplest approach can be using my own numbering (using a counter, or manually)

\boxed{ \href{www.google.com}{1} } This is the first post
\boxed{ \href{www.google.com}{2} } This is the first post

But with this structure, I lost the indentation that "enumerate" presents. How can I preserve the indentation

enter image description here

1
  • With an enumerated environment, you can assign \labels to individual items and cross-reference them elsewhere via \ref statements. And, if hyperref is loaded these cross-references will be made into hyperlink targets automatically.
    – Mico
    Aug 18 '13 at 8:08
1

If I got your problem right, this works for me:

\documentclass{article}

\usepackage{amsmath}
\usepackage{hyperref}

\begin{document}

\begin{enumerate}
\item This is the first post
\item[\boxed{\href{www.google.com}{2}}] This is the second post
\end{enumerate}

\end{document}

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.