是否可以在句子中間創造一個垂直空間?

是否可以在句子中間創造一個垂直空間?

我想將連結放在標題中間(Pomodoro、Duelr)。解決這個問題的最佳方法是什麼?我的程式碼如下所示:

\begin{tabularx}{\linewidth}{X r}
    \rule{0pt}{17pt}
    \hspace{-0.2em}\large\textbf{\textsc{Pomodoro} \vspace{0.5em} \href{https://www.GitHub.com/AllanMukundi/Pomodoro}{\fontsize{7}{8.4}\selectfont - https://www.GitHub.com/AllanMukundi/Pomodoro}} & \textit{May 2017}
\end{tabularx}
\vspace{-1.60em}
\begin{itemize}[noitemsep]
    \item A productivity-oriented web application which incentivizes the Pomodoro Technique via a reward system
    \item Features a dynamic leaderboard, responsive design, and user authentication with support for social accounts
    \item Deployed onto Heroku and built using Django/Python, HTML5, CSS, Bootstrap, JavaScript, jQuery, and AJAX
\end{itemize}
\begin{tabularx}{\linewidth}{X r}
    \rule{0pt}{17pt}
    \hspace{-0.2em}\large\textbf{\textsc{Duelr} \href{https://www.GitHub.com/AllanMukundi/Duelr}{\fontsize{7}{8.4}\selectfont - https://www.GitHub.com/AllanMukundi/Duelr}} & \textit{Jun. 2017}
\end{tabularx}
\vspace{-1.60em}
\begin{itemize}[noitemsep]
    \item Duelr is an online multiplayer 1v1 fighting game which uses web sockets to deliver real-time interactions
    \item Features fluid character animations, intuitive controls, and fully functional collision mechanisms
    \item Hosted on Microsoft Azure and built with JavaScript, Node.js, Express.js, Socket.io, HTML5, CSS, and Phaser
\end{itemize}

樣本

答案1

如果我理解正確的話,你只想提出如下的網址。

在此輸入影像描述

\documentclass{article}

\usepackage{tabularx,enumitem}
\usepackage[colorlinks]{hyperref}

\newcommand\midl[1]{\raisebox{1pt}{#1}}
\begin{document}

\sffamily

\begin{tabularx}{\linewidth}{X r}
    \rule{0pt}{17pt}
    \hspace{-0.2em}\large\textbf{%
\textsc{Pomodoro}
\midl{\href{https://www.GitHub.com/AllanMukundi/Pomodoro}{\fontsize{7}{8.4}\selectfont - https://www.GitHub.com/AllanMukundi/Pomodoro}}} & \textit{May 2017}
\end{tabularx}
\vspace{-1.60em}
\begin{itemize}[noitemsep]
    \item A productivity-oriented web application which incentivizes the Pomodoro Technique via a reward system
    \item Features a dynamic leaderboard, responsive design, and user authentication with support for social accounts
    \item Deployed onto Heroku and built using Django/Python, HTML5, CSS, Bootstrap, JavaScript, jQuery, and AJAX
\end{itemize}
\begin{tabularx}{\linewidth}{X r}
    \rule{0pt}{17pt}
    \hspace{-0.2em}\large\textbf{%
\textsc{Duelr}
\midl{\href{https://www.GitHub.com/AllanMukundi/Duelr}{\fontsize{7}{8.4}\selectfont - https://www.GitHub.com/AllanMukundi/Duelr}}} & \textit{Jun. 2017}
\end{tabularx}
\vspace{-1.60em}
\begin{itemize}[noitemsep]
    \item Duelr is an online multiplayer 1v1 fighting game which uses web sockets to deliver real-time interactions
    \item Features fluid character animations, intuitive controls, and fully functional collision mechanisms
    \item Hosted on Microsoft Azure and built with JavaScript, Node.js, Express.js, Socket.io, HTML5, CSS, and Phaser
\end{itemize}

\end{document}

答案2

您可以使用\raisebox並計算它必須升高的高度:

\documentclass[]{article}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{enumitem}

\newdimen\mytitlehtONE
\newdimen\mytitlehtTWO

\newcommand{\mytitle}[2]{%
    \setbox0\hbox{\large\textbf{\textsc{#1}}}%
    \mytitlehtONE=\ht0%
    \setbox0\hbox{\textbf{\href{#2}{\fontsize{7}{8.4}\selectfont - #2}}}%
    \mytitlehtTWO=\ht0%
    \advance\mytitlehtONE by -\mytitlehtTWO\relax%
    \hspace{-0.2em}\fbox{\large\textbf{\textsc{#1}}}
    \raisebox{0.5\mytitlehtTWO}{\unhbox0}}

\begin{document}
\begin{tabularx}{\linewidth}{X r}
    \rule{0pt}{17pt}
    \mytitle{Pomodoro}{https://www.GitHub.com/AllanMukundi/Pomodoro} & \textit{May 2017}
\end{tabularx}
\end{document}

結果是: 在此輸入影像描述

\fbox只是為了表明它確實是在這條線的中間。如果沒有它,命令是:

\newcommand{\mytitle}[2]{%
    \setbox0\hbox{\large\textbf{\textsc{#1}}}%
    \mytitlehtONE=\ht0%
    \setbox0\hbox{\textbf{\href{#2}{\fontsize{7}{8.4}\selectfont - #2}}}%
    \mytitlehtTWO=\ht0%
    \advance\mytitlehtONE by -\mytitlehtTWO\relax%
    \hspace{-0.2em}\large\textbf{\textsc{#1}}
    \raisebox{0.5\mytitlehtTWO}{\unhbox0}}

答案3

另一種可能性:沿著數學軸居中。這樣做的好處是,它可以自動縮放到不同的尺寸,而無需測量臨時盒子;它的缺點是需要一些低階 TeX 編碼。

以下程式碼的輸出

原始碼如下。我還在幾個方面清理了它。

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{enumitem}
\usepackage[colorlinks]{hyperref}

\makeatletter

\newenvironment*{myList}[3]{%
    {\noindent \parfillskip\z@skip
        \rule{0pt}{17pt}% <-- !!! (But why this rule?)
        % \hspace{-0.2em} % no longer necessary, I guess! ;-)
        {\large
            {%
                \bfseries
                % \scshape % not supported
                #1\/%
            }%
            ~$\m@th \vcenter{\hbox{\scriptsize - \url{#2}}}$%
        }%
        \nobreak\hfill \textit{#3}\@@par
    }%
    % \vspace{-1.60em} % specify "nosep" instead of "noitemsep"
    \begin{itemize}[nosep]%
}{%
    \end{itemize}%
}

\makeatother



\begin{document}

\sffamily

\begin{myList}
        {Pomodoro}
        {https://www.GitHub.com/AllanMukundi/Pomodoro}
        {May 2017}

    \item
        A productivity-oriented web application which incentivizes the Pomodoro
        Technique via a reward system.

    \item
        Features a dynamic leaderboard, responsive design, and user
        authentication with support for social accounts.

    \item
        Deployed onto Heroku and built using Django/Python, HTML5, CSS\@,
        Bootstrap, JavaScript, jQuery, and AJAX\@. %"\@" for precaution
\end{myList}

\begin{myList}
        {Duelr}
        {https://www.GitHub.com/AllanMukundi/Duelr}
        {Jun. 2017}

    \item
        Duelr is an online multiplayer 1v1 fighting game which uses web sockets
        to deliver real-time interactions.

    \item
        Features fluid character animations, intuitive controls, and fully
        functional collision mechanisms.

    \item
        Hosted on Microsoft Azure and built with JavaScript, Node.js,
        Express.js, Socket.io, HTML5, CSS\@, and Phaser.
\end{myList}

\end{document}

相關內容