\documentclass[12pt, letterpaper]{article}
\usepackage[
a4paper,top=1in,bottom=1in,left=0.7in,right=0.7in,headheight=14.5pt,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{forest}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent\textbf{Solution: 5}
\noindent\begin{minipage}[t]{0.45\textwidth}
In $\triangle ABC,$ $CD\perp AB$ and $\angle D= 90^{\circ}$
Given that,
\begin{align*}
\cos A &=\cos B\\[6pt]
\therefore\;\;\dfrac{AD}{AC}&=\dfrac{BD}{BC}\\[6pt]
\therefore\;\;\dfrac{AD}{BD}&=\dfrac{AC}{BC}= k\quad (\text{say})\\[6pt]
\therefore\;\;AD&=kBD \tag{1}\\[6pt]
AC&=kBC \tag{2}
\end{align*}
\end{minipage}\hspace{\fill}%
\begin{minipage}[t]{0.45\textwidth}
\vspace{0pt} % to anchor the minipage at the very top
\raggedleft
\begin{tikzpicture}
\tkzDefPoint(0:0){A}
\tkzDefPoint(0:6){B}
\tkzDefPoint(45:4){C}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint[below,yshift=-0.8mm](B){$B$}
\tkzLabelPoint[below,yshift=-0.8mm](A){$A$}
\tkzDrawSegment[black!60!black](C,A)
\tkzDrawSegment[black!60!black](A,B)
\tkzDrawSegment[black!60!black](C,B)
\tkzDrawAltitude[color=black](A,B)(C)
\tkzGetPoint{D}%Get the point of intersection
\tkzLabelPoint[below](D){$D$}
\tkzMarkRightAngle(C,D,A)%Mark with a right angle symbol
\end{tikzpicture}
\end{minipage}
\end{document}
问题:我制作的迷你页面,两个部分都没有正确水平对齐。我哪里出错了,请指导我。在使用迷你页面环境时,我经常遇到同样的问题。我之前已经问过这种问题,并找到了该问题的解决方案,但当我将该代码用于其他示例时,它不起作用。
答案1
问题出在线路上
\tkzDrawAltitude[color=black](A,B)(C)
这会在三角形顶部添加额外的空间。在本文档中http://texdoc.net/texmf-dist/doc/latex/tkz-euclide/tkz-euclide-screen.pdf第 87 页有一个使用此命令的示例。他们在开头添加了一行,tikzpicture
使其在没有额外空格的情况下工作。
\tkzInit[xmin=-1,xmax=7,ymin=-1,ymax=4]\tkzClip
对于您的示例,我更喜欢使用两列而不是两列minipage
?此代码为您提供了预期的结果:
\documentclass[12pt, letterpaper]{article}
\usepackage[
a4paper,top=1in,bottom=1in,left=0.7in,right=0.7in,headheight=14.5pt,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{forest}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{multicol}
\usetkzobj{all}
\begin{document}
\begin{multicols}{2}
\noindent\textbf{Solution: 5}
In $\triangle ABC,$ $CD\perp AB$ and $\angle D= 90^{\circ}$
Given that,
\begin{align*}
\cos A &=\cos B\\[6pt]
\therefore\;\;\dfrac{AD}{AC}&=\dfrac{BD}{BC}\\[6pt]
\therefore\;\;\dfrac{AD}{BD}&=\dfrac{AC}{BC}= k\quad (\text{say})\\[6pt]
\therefore\;\;AD&=kBD \tag{1}\\[6pt]
AC&=kBC \tag{2}
\end{align*}
\columnbreak
\begin{center}
\begin{tikzpicture}[auto]
\tkzInit[xmin=-1,xmax=7,ymin=-1,ymax=4]\tkzClip
\tkzDefPoint(0:0){A}
\tkzDefPoint(0:6){B}
\tkzDefPoint(45:4){C}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint[below,yshift=-0.8mm](B){$B$}
\tkzLabelPoint[below,yshift=-0.8mm](A){$A$}
\tkzDrawSegment[black!60!black](C,A)
\tkzDrawSegment[black!60!black](A,B)
\tkzDrawSegment[black!60!black](C,B)
\tkzDrawAltitude[color=black](A,B)(C)
\tkzGetPoint{D}%Get the point of intersection
\tkzLabelPoint[below](D){$D$}
\tkzMarkRightAngle(C,D,A)%Mark with a right angle symbol
\end{tikzpicture}
\end{center}
\end{multicols}
\end{document}
编辑:与minipage
环境
\documentclass[12pt, letterpaper]{article}
\usepackage[
a4paper,top=1in,bottom=1in,left=0.7in,right=0.7in,headheight=14.5pt,]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{forest}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent\textbf{Solution: 5}
\noindent\begin{minipage}[t]{0.45\textwidth}
In $\triangle ABC,$ $CD\perp AB$ and $\angle D= 90^{\circ}$
Given that,
\begin{align*}
\cos A &=\cos B\\[6pt]
\therefore\;\;\dfrac{AD}{AC}&=\dfrac{BD}{BC}\\[6pt]
\therefore\;\;\dfrac{AD}{BD}&=\dfrac{AC}{BC}= k\quad (\text{say})\\[6pt]
\therefore\;\;AD&=kBD \tag{1}\\[6pt]
AC&=kBC \tag{2}
\end{align*}
\end{minipage}
\noindent\begin{minipage}[t]{0.45\textwidth}
\begin{center}
\begin{tikzpicture}[auto]
\tkzInit[xmin=-1,xmax=7,ymin=-1,ymax=4]\tkzClip
\tkzDefPoint(0:0){A}
\tkzDefPoint(0:6){B}
\tkzDefPoint(45:4){C}
\tkzLabelPoint[above](C){$C$}
\tkzLabelPoint[below,yshift=-0.8mm](B){$B$}
\tkzLabelPoint[below,yshift=-0.8mm](A){$A$}
\tkzDrawSegment[black!60!black](C,A)
\tkzDrawSegment[black!60!black](A,B)
\tkzDrawSegment[black!60!black](C,B)
\tkzDrawAltitude[color=black](A,B)(C)
\tkzGetPoint{D}%Get the point of intersection
\tkzLabelPoint[below](D){$D$}
\tkzMarkRightAngle(C,D,A)%Mark with a right angle symbol
\end{tikzpicture}
\end{center}
\end{minipage}
\end{document}
答案2
\vspace{-3cm}
正如大卫提到的,解决这类问题最快的方法是通过在物体前添加或类似的东西(负垂直距离)迫使物体向上移动。
我想您可能会发现该包parskip
很有用,因为您在每个段落之前都使用过它\noindent
。\usepackage{parskip}
它消除了缩进,而是用一个小的垂直空间来分隔段落。
其次,您可以通过调用一堆包来缩短代码:
\usepackage{amsmath, amsfonts, mathtools, amssymb, forest, tikz, tkz-euclide}
当然,需要在方括号中选择选项的包不能与这些其他包捆绑在一起。