正確對齊定義的部分標題

正確對齊定義的部分標題

這是我試圖在一個大型專案中定義的部分標題的 MWE。

\documentclass[a2,portrait]{a0poster}

\usepackage{tikz}

% Blue section, large, text on next line.
\def\Lsect#1{\noindent\hbox to \hsize{\large\color{blue} #1}\bigskip}

\begin{document}

\Lsect{This is a title}

Some text.

\end{document}

這是輸出:

在此輸入影像描述

我已經刪除了 LaTeX 文件中所有非必要的行來重現該問題(但我不確定為什麼tikz需要在那裡)

我需要將標題正確地向左對齊,但我只是不知道如何做到這一點,我已經嘗試了我能想到的定義的所有修改。

答案1

如果您將水平盒指定為特定大小,TeX 將嘗試使內容適合該大小。如果想要將內容對齊到某個方向,請嘗試以下橡膠長度之一:

  • \hfil\hfill或者\hfilll
  • \hss

\documentclass[a2,portrait]{a0poster}
\usepackage{tikz}
% Blue section, large, text on next line.
\def\Lsect#1{\noindent\hbox to \hsize{\large\color{blue} #1\hfil}\bigskip}
\begin{document}
\Lsect{This is a title}
Some text.
\end{document}

在此輸入影像描述

相關內容