<s>[INST] How to convert a fraction into ternary? In a ternary system how is $\dfrac{1}{2}=0.\bar1$ ,$\dfrac{1}{3}=0.1=0.0\bar2$??, etc. In general, how does one write the ternary expression for a given fraction?
 [/INST] I assume you know how to convert integers from base 10 to base 3, so this answer will address fractions between $0$ and $1$.
To say, for example, that $\frac{5}{8} = 0.625$ means that $\frac{5}{8} = 6 \frac{1}{10} + 2 \frac{1}{100} + 5 \frac{1}{1000}$.  So to convert a fraction $\frac{a}{b}$ to ternary means we want to find coefficients $c_1, c_2, c_3, \ldots$ such that $$\frac{a}{b} = c_1 \frac{1}{3} + c_2 \frac{1}{3^2} + c_3 \frac{1}{3^3} + \cdots.$$
Finding these coefficients can be automated.  In fact, what follows is exactly the long division algorithm taught in elementary school for converting fractions to decimals, adapted to base 3.  (You could also simply convert everything to base 3 first and then do long division, as is mentioned in the comments.  For the algorithm described below, though, all the calculations can be done in base 10, which is nice since we're used to working in base 10.)
To find $c_1$, multiply the equation above by $3$ to obtain $$\frac{3a}{b} = c_1  + c_2 \frac{1}{3} + c_3 \frac{1}{3^2} + \cdots .$$  Divide $b$ into $3a$ to get $\frac{3a}{b} = \frac{qb + r}{b}$, with $q$ the quotient and $r$ the remainder.  The quotient $\frac{qb}{b} = q$ will equal $c_1$, the integer part of the right-hand side, and $\frac{r}{b}$ will be the fractional part; i.e., $$\frac{r}{b} = c_2 \frac{1}{3} + c_3 \frac{1}{3^2} + \cdots.$$  Then multiply by $3$ again, and repeat the procedure until it terminates or starts repeating itself.
In tabular form and applied to $\frac{5}{8}$, this process looks like the following, where the numerator of the fraction in each line comes from $3r$ in the previous line.
$$\begin{matrix} \text{current fraction } & \text{quotient } q & \text{remainder } r & 3r \\
\frac{5}{8} & 0 & 5 & 15 \\
\frac{15}{8} &1 & 7 & 21\\
\frac{21}{8} &2 & 5 & 15\\
\frac{15}{8} &1 & 7 & 21\\
\frac{21}{8} &2 & 5 & 15\\
\vdots & \vdots & \vdots & \vdots \\
\end{matrix}$$
The base 3 representation comes from the quotients, so $\frac{5}{8}$ in ternary must be $0.\overline{12}_3$.
So why is this equivalent to long division?  With long division, after finding a quotient and a remainder in a particular step, you then "carry down the $0$," which entails  concatenating a $0$ on the end of the remainder.  Mathematically, adding a $0$ on the end of a number in base 10 means that you are multiplying it by $10$.  Since we're working in base 3 here, we want to multiply the remainder by $3$.  That's the only difference between what I've said here and the long division algorithm taught in elementary school.
</s>