DEV Community

Cover image for ก้าวแรกสู่ LaTeX ฉบับผู้ใช้ MacM2
terngr
terngr

Posted on

ก้าวแรกสู่ LaTeX ฉบับผู้ใช้ MacM2

LaTeX เป็นเครื่องมือสำหรับสร้างเอกสาร คล้ายๆ กับ MS Word, MS Power Point แต่ต่างกันที่ LaTeX เขียนด้วยตัวอักษรล้วนๆ ไม่มีปุ่่มปรับขนาด สี จัดย่อหน้า ฯลฯ

เราอาจเทียบการ LaTeX ได้กับการเขียน HTML ที่ถ้าเราต้องการตัวอักษรตัวใหญ่ใน HTML ก็สามารถใส่ tag แบบนี้ครับ

<h1> My Header </h1>
my normal text

Enter fullscreen mode Exit fullscreen mode

Image description

เริ่ม Download และติดตั้ง MacTeX จาก https://tug.org/mactex/

จากนั้นจะได้โปรแกรม TeXShop ให้เปิด TeXShop ขึ้นมา จะเป็นหน้าจอเปล่า

Image description

เริ่มเขียน LaTeX ได้ตามตัวอย่างนี้ โดย % % คือการ comment และสามารถใส่ Command tag ได้ด้วย \<commamd>

%This is preamble sections%
\documentclass[12pt, letterpaper]{article}
\title{My first LaTeX document}
\author{Peter}
\date{February 7, 2023}

%Begin of the document%
\begin{document}
\maketitle
Good evening and welcome everyone to the first \LaTeX{} document.
\end{document}
Enter fullscreen mode Exit fullscreen mode

จากนั้น save ไฟล์ โดยกำหนดนามสกุล .tex

สำคัญมาก จะต้องตั้งนามสกุลไฟล์เป็น .tex เท่านั้น เพื่อให้สร้างเป็นเอกสารได้

จากนั้นกดที่ปุ่ม Typeset มุมด้านบนซ้าย เพื่อ Compile ไฟล์ .tex ให้เป็น .pdf

Image description

Latest comments (0)